SRVPickerButton 1.0.0

SRVPickerButton 1.0.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Unclaimed.



  • By
  • Sam Voigt

A UIButton that can become first responder and present a picker

Usage:

(see sample Xcode project in /SRVPickerButtonDemo)

SRVPickerButtons can be used in IB or in code, and can be subclassed. Each button must have a delegate that subscribes to the SRVPickerButttonDelegate protocol, and implements the following methods:

- (NSInteger)numberOfRowsInPickerButton:(SRVPickerButton *)pickerButton;
- (NSString *)pickerButton:(SRVPickerButton *)pickerButton titleForRow:(NSInteger)row;
- (void)pickerButton:(SRVPickerButton *)pickerButton didSelectRow:(NSInteger)row;

Additionally, there are the following optional delegate methods:

- (void)pickerButtonDidCancel:(SRVPickerButton *)pickerButton;
- (void)pickerButton:(SRVPickerButton *)pickerButton scrolledToRow:(NSInteger)row;

These are all similar to UIPickerButton Datasource/Delegate methods, with the exception being that the UIPickerDelegate didSelectRow corresponds to the SRVPickerButton didScrollToRow.