CocoaPods trunk is moving to be read-only. Read more on the blog, there are 13 months to go.
| TestsTested | ✗ |
| LangLanguage | SwiftSwift |
| License | MIT |
| ReleasedLast Release | Jan 2016 |
| SPMSupports SPM | ✗ |
Maintained by Akkyie.
A simple yet customizable horizontal picker view.
The Swift port of AKPickerView.
Works on iOS 7 and 8.
Add AKPickerView.swift into your Xcode project.
Instantiate and set delegate and dataSource as you know,
self.pickerView = AKPickerView(frame: <#frame#>)
self.pickerView.delegate = self
self.pickerView.dataSource = selfthen specify the number of items using AKPickerViewDataSource,
func numberOfItemsInPickerView(pickerView: AKPickerView) -> Int {}and contents to be shown. You can use either texts or images:
func pickerView(pickerView: AKPickerView, titleForItem item: Int) -> NSString {}
// OR
func pickerView(pickerView: AKPickerView, imageForItem item: Int) -> UIImage {}titleForItem will be called and the other won’t. You can change its appearance with properties below:
var font: UIFont
var highlightedFont: UIFont
var textColor: UIColor
var highlightedTextColor: UIColor
var interitemSpacing: CGFloat
var viewDepth: CGFloat
var pickerViewStyle: AKPickerViewStyleAfter all settings, never forget to reload your picker.
self.pickerView.reloadData()Optional: You can use AKPickerViewDelegate methods to observe selection changes:
func pickerView(pickerView: AKPickerView, didSelectItem item: Int) {}Additionally, you can also use UIScrollViewDelegate methods to observe scrolling.
For more detail, see the sample project.
@akkyie http://twitter.com/akkyie
MIT. See LICENSE.