Tuesday, February 11, 2020

Create Smooth Dropdown on iOS swift 5


Welcome back to my blog guys, today I want to share something about dropdown thing. Dropdown is not something that is exist on iOS UIKit. On iOS we have something similiar to dropdown menu Android that is Picker View. But sometimes we need to create UI same as Android. It will have better User Expierence.

Fortunetely some people have dealt with our problems. So they created the dropdown menu in their own. What I have used is what I'm gonna share today. It's DropDown created by jriosdev, I will share github link on below, don't worry about it.

You install dropdown in your project using CocoaPods, or You just simply add Dropdown library by creating class named DropDown and add Textfield in your Storyboard then change class Textfield to Dropdown. For more details how to install this library you can check their github. I will give the link github below OK.

But we have some problem about the animation when dropdown menu clicked. It makes the dropdown slow, but fortunely you can remove the bounce animation actually, In DropDown.swift change all the UIView.animate to withDuration: 0.0 and delay: 0.0 would fix it. Or you just copy paste code below in DropDown.swift. After that try to run your app and see If there's no animation again and slow issue is solved :D.

This is the full code I have edited :


Thanks for visiting my simple blog. I hope It will help you have a nice dropdown in your app. If you have any question, please feel free to ask. I'm glad I can help you all guys. Thanks.

link github  dropdown : https://github.com/jriosdev/iOSDropDown

No comments:

Post a Comment