Simple Spinner with dropdown-list for iOS (like android)
View live demo in Appetize : https://appetize.io/app/m4gbf5ghpyh4bw4vpdcjxgk218?device=iphone5s&scale=75&orientation=portrait&osVersion=9.2
Import LBZSpinner.swift in your project (or use example project)
let spinnerCode = LBZSpinner(frame: CGRect(x: 90,y: 30,width: 180,height: 45))
self.view.addSubview(spinnerCode)
spinnerCode.decoratedSpinner(UIColor.purpleColor(), lineColor: UIColor.brownColor(), text: "Choose value")
(Use nil parameter for default value)
spinnerCode.decoratedDropDownList(UIColor.lightGrayColor(), textColor: UIColor.redColor(), withStroke: true, strokeSize: 5, strokeColor: nil)
(Use nil parameter for default value)
In Storyboard, place a simple UIView in your ViewController
let listCode = ["Books","Video","Streaming","Download","Upload"]
spinnerCode.updateList(listCode)
Use LBZSpinnerDelegate for event return :
class ViewController: UIViewController, LBZSpinnerDelegate
spinnerCode.delegate = self
func spinnerChoose(spinner:LBZSpinner, index:Int,value:String) {
print("Spinner : \(spinner) : { Index : \(index) - \(value) }")
}
Get actual selected index :
var index = spinnerBot.selectedIndex
if no selected value :
if spinnerBot.selectedIndex == LBZSpinner.INDEX_NOTHING {
print("NOTHING VALUE")
}
Set actual selected index :
spinnerBot.changeSelectedIndex(1)
Example 1 :
Example 2 :
Example of dip type and LeBzul type
Guillian Drouin, [email protected]
Dip kasyap, [email protected] (dip type added)
LBZSpinner is available under the Apache license. See the LICENSE file for more info.