It's a Swift Library to support Drop Down Menu in iOS
To run the example project, clone the repo, and run pod install
from the Example directory first.
- Simple UITextField Extension And simple to use , We can Access all properties of UITextField
- DropDown Search can enable or desable
- Change color of List backgound and selected color
- Change Maximum Hieght of List and Height of each Row
Use CocoaPods. iOSDropDown is available through CocoaPods. To install it, simply add the following line to your Podfile:
- Add
pod 'iOSDropDown'
to your Podfile. - Install the pod(s) by running
pod install
. - Add
import iOSDropDown
in the .swift files where you want to use it
Use Carthage.
- Create a file name
Cartfile
. - Add the line
github "jriosdev/iOSDropDown"
. - Run
carthage update
. - Drag the built
iOSDropDown.framework
into your Xcode project.
Just clone and add the following Swift files to your project:
- iOSDropDown.swfit
Simply add UITextField to Your ViewCOntroller And Connect @IBOutlet to DropDown Class
@IBOutlet weak var dropDown : DropDown!
// The list of array to display. Can be changed dynamically
dropDown.dropDown.optionArray = ["Option 1", "Option 2", "Option 3"]
// The the Closure returns Selected Index and String
dropDown.didSelect{(selectedText , index) in
self.valueLabel.text = "Selected String: \(selectedText) \n index: \(index)"
}
let dropDown = DropDown()
dropDown.frame = CGRect(x:50 ,y:70 , width:200 , height:40) //Set frame
// The list of array to display. Can be changed dynamically
dropDown.dropDown.optionArray = ["Option 1", "Option 2", "Option 3"]
// The the Closure returns Selected Index and String
dropDown.didSelect{(selectedText , index) in
self.valueLabel.text = "Selected String: \(selectedText) \n index: \(index)"
}
Actions
dropDown.showList() // To show the Drop Down Menu
dropDown.hideList() // To hide the Drop Down Menu
Closures
listWillAppear() {
//You can Do anything when iOS DropDown willAppear
}
listDidAppear() {
//You can Do anything when iOS DropDown listDidAppear
}
listWillDisappear() {
//You can Do anything when iOS DropDown listWillDisappear
}
listDidDisappear() {
//You can Do anything when iOS DropDown listDidDisappear
}
You can customize these properties of the drop down:
isSearchEnabled
: You can Enable or Desable on DropDown .Default value Istrue
hideOptionsWhenSelect
: This option to hide the list when click option one item. Default value istrue
selectedRowColor
: Color of selected Row item in DropDown Default value is.cyan
rowBackgroundColor
: Color of DropDown Default value is.white
tableHeight
: The maximum Height of of List. Default value is100
rowHeight
: The Height of of List in the List. Default value is50
Jishnu RajT, jriosdev@gmail.com
iOSDropDown is available under the MIT license. See the LICENSE file for more info.