Skip to content

george-gw/FSDDropdownPicker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FSDDropdownPicker

Version License Platform

##Example

Example

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

###Create instance You can create an intance directly by passing in an NSArray of items that conform to the FSDPickerItemProtocol, if you just want an item with a name and image you can use the provided FSDPickerItem :

FSDPickerItem* item1 = [[FSDPickerItem alloc] initWithName:@"name" andImage:[UIImage imageNamed:@"1"]];
...    
FSDDropdownPicker *picker = [[FSDDropdownPicker alloc] initWithOptions:@[item1]];    

You will then have to add it to your view manually. You can alternatively use a convenience method to directly add the picker to the right of a navigation bar:

FSDDropdownPicker *picker =  [self.navigationItem addDropdownPickerWithOptions:@[item1, item2, item3]];

The dropdown picker will dismiss if tapped outside or tapped the dropdown button.

###FSDDropdownPickerDelegate

The delegate can respond to the following events:

picker.delegate = self;

- (void)dropdownPicker:(FSDDropdownPicker *)dropdownPicker didDropDown:(BOOL)drop {
    //do something when the picker dropped down or up
}
- (BOOL)dropdownPicker:(FSDDropdownPicker *)dropdownPicker 	didSelectOption:(id <FSDPickerItemProtocol> )option {
	// called when user selects an option
}

###Customization

You can customize the following options:

/**
 *  The height of each option in the dropdown picker
 */
@property (assign, nonatomic) CGFloat rowHeight;

/**
 *  Whether to show images when the picker drops down or not
 */
@property (assign, nonatomic) BOOL displaysImageInList;


/**
 *  The list separator style for the picker items
 */
@property (assign, nonatomic) UITableViewCellSeparatorStyle listSeparator;

Installation

FSDDropdownPicker is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "FSDDropdownPicker"

Or to view the example project: pod try "FSDDropdownPicker"

Pull requests or any suggestions are welcome

Author

Felix Dumit, felix.dumit@gmail.com

License

FSDDropdownPicker is available under the MIT license. See the LICENSE file for more info.

About

A simple dropdown list picker for iOS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 93.2%
  • Shell 4.2%
  • Ruby 1.7%
  • C 0.9%