TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Nov 2016 |
Maintained by Unclaimed.
LAPickerView is an horizontal spinning-wheel picker control view for iOS.
It is similar to UIPickerView, but the user interface provided consists of columns instead of rows. It also follows the same semantics used for the data source and delegate methods. Please read the Overview section for more details about usage.
You also need to add the following frameworks to your project:
LAPickerView * pickerView = [[LAPickerView alloc] initWithFrame:self.view.frame];
pickerView.dataSource = self; // LAPickerViewDataSource protocol
pickerView.delegate = self; // LAPickerViewDelegate protocol
[self.view addSubview:pickerView];
- (NSInteger)numberOfComponentsInPickerView:(LAPickerView *)pickerView
{
// return the number of components needed
}
- (NSInteger)pickerView:(LAPickerView *)pickerView numberOfColumnsInComponent:(NSInteger)component
{
// return the number of columns for each component
}
- (NSString *)pickerView:(LAPickerView *)pickerView titleForColumn:(NSInteger)column forComponent:(NSInteger)component
{
// return the title for the specific column-component pair
}
- (void)pickerView:(LAPickerView *)pickerView didSelectColumn:(NSInteger)column inComponent:(NSInteger)component
{
// called when a new, different column is selected following a user touch-based input
}
pickerView.selectionAlignment = LAPickerSelectionAlignmentLeft; // Change selected column position to left
The LAPickerViewOverview is a single-view example showing the LAPickerView and UIPickerView side-by-side. The selection is linked, so changing the selected column in the LAPickerView will trigger the UIPickerView to change to the corresponding row.