CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Nov 2015 |
Maintained by Akkyie.
A simple yet customizable horizontal picker view.
Works on iOS 6, 7 and 8.
News: Say Good-Bye to Bridging-Header! The Swift version is here.
…or simply add AKPickerView.h/m into your project.
Caveat: From version 2.0, dataSource separated from delegate. When you updated it, check new how to use below.
Instantiate and set delegate and dataSource as you know,
self.pickerView = [[AKPickerView alloc] initWithFrame:<#frame#>];
self.pickerView.delegate = self;
self.pickerView.dataSource = self;then specify the number of items using AKPickerViewDataSource methods,
- (NSUInteger)numberOfItemsInPickerView:(AKPickerView *)pickerView;and specify contents to be shown. You can use either texts or images:
- (NSString *)pickerView:(AKPickerView *)pickerView titleForItem:(NSInteger)item;
// OR
- (UIImage *)pickerView:(AKPickerView *)pickerView imageForItem:(NSInteger)item;-pickerView:titleForItem will be called and the other won't. You can change its appearance with properties below.
@property (nonatomic, strong) UIFont *font;
@property (nonatomic, strong) UIFont *highlightedFont;
@property (nonatomic, strong) UIColor *textColor;
@property (nonatomic, strong) UIColor *highlightedTextColor;
@property (nonatomic, assign) CGFloat interitemSpacing;
@property (nonatomic, assign) CGFloat fisheyeFactor;After all settings, never forget to reload your picker.
[self.pickerView reloadData];Optional: You can use AKPickerViewDelegate method to observe selection changes:
- (void)pickerView:(AKPickerView *)pickerView didSelectItem:(NSInteger)item;Additionally, you can use UIScrollViewDelegate method to observe scrolling.
For more detail, see the sample project.
@akkyie http://twitter.com/akkyie
MIT. See LICENSE.