SMPickerView is a custom PickerView with up/down buttons
Clone the repo and run the example project. This Example demonstrate how to use the SMPickerView.
Drag and drop SMPickerView.swift into your project.
- Open a storyboard or xib file.
- Drag and drop UIView to your UIView, UIViewController,...
- In Identity inspector, replace the class from UIView with SMPickerView.
- Add images to your assets file.
- Create an outlet to SMPickerView.
- In your code: set the delegate to SMPickerView's outlet and set the pickerData attribute with an array of String.
pickerView.delegate = self
pickerView.pickerData = ["Apple", "Banana", "Lemon", "Abricot"]
var pickerView = SMPickerView(frame: CGRect(x: 20, y: 20, width: 200, height: 50))
pickerView.delegate = self
pickerView.pickerData = ["Apple", "Banana", "Lemon", "Abricot"]
self.view.addSubview(pickerView)
Sihem MOHAMED