KPDropMenu is an Objective-C port of HADropDown. It expands and collapses in two directions (up & down). It allows the user to select only one item at a time. One can customize font, color, item height, alignment, etc in code (as well as Interface Builder).
Simply include KPDropMenu.h and KPDropMenu.m file into your project directory.
- Add UIView in interface builder and change its class from UIView to KPDropMenu
- Customize Properties with the help of attribute inspector
KPDropMenu *dropNew = [[KPDropMenu alloc] initWithFrame:CGRectMake(8, 250, 150, 50)];
dropNew.delegate = self;
dropNew.items = @[@"Apple", @"Grapes", @"Cherry", @"Pineapple", @"Mango", @"Orange"];
dropNew.title = @"Select Again";
dropNew.itemsFont = [UIFont fontWithName:@"Helvetica-Regular" size:12.0];
dropNew.titleTextAlignment = NSTextAlignmentCenter;
dropNew.DirectionDown = NO;
[self.view addSubview:dropNew];
To Use delegate methods, implement KPDropMenuDelegate
protocol. All these 3 methods are optional
.
-(void)didSelectItem : (KPDropMenu *) dropMenu atIndex : (int) atIntedex;
-(void)didShow : (KPDropMenu *)dropMenu;
-(void)didHide : (KPDropMenu *)dropMenu;
iOS 7.0 and later
MIT License