FYComboBox is a flexible and easy to use ComboBox. You can configure the look and feel on Interface Builder.
- Add
pod 'FYComboBox'
to your project's Podfile - Run
pod install
Important: in order to make FYComboBox
really flexible the control doesn't implement any extra component automatically like a UILabel
or UIImageView
. Instead you use the delegate methods to handle the changes on your interface programmatically. See the example project for references.
Select a View an change its class to FYComboBox
in the identity inspector.
You can also configure other aspects of the ComboBox in the attributes inspector.
Implement FYComboBoxDelegate
to handle datasource and events.
// Example
@interface ExampleViewController
@property (nonatomic, strong) NSArray *array;
@end
// ...
#pragma mark - FYComboBoxDelegate
- (NSInteger)comboBoxNumberOfRows:(FYComboBox *)comboBox
{
return self.array.count;
}
- (NSString *)comboBox:(FYComboBox *)comboBox titleForRow:(NSInteger)row
{
return self.array[row];
}
- (void)comboBox:(FYComboBox *)comboBox didSelectRow:(NSInteger)row
{
NSLog(@"Selected %@", self.array[row]);
[comboBox closeAnimated:YES];
}
You can check the license in the license file