easy framework to setup pickers in your iOS project, easy picker manager.
you can see how to works in the example project the file named "SBViewController" in the method showPicker:
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like SBPickerSelector in your projects.
platform :ios, '5.0'
pod "SBPickerSelector", "~> 1.0.2"
- import in your project the folder "SBPickerSelector"
###How to use
- in your code import SBPickerSelector.h
#import "SBPickerSelector.h"
- implement delegate in your class
@interface className : UIViewController <SBPickerSelectorDelegate>
- add delegate methods depends of your necesities
//if your piker is a traditional selection
-(void) SBPickerSelector:(SBPickerSelector *)selector selectedValue:(NSString *)value index:(NSInteger)idx;
//if your picker is a date selection
-(void) SBPickerSelector:(SBPickerSelector *)selector dateSelected:(NSDate *)date;
//when picker value is changing
-(void) SBPickerSelector:(SBPickerSelector *)selector intermediatelySelectedValue:(id)value atIndex:(NSInteger)idx;
//if the user cancel the picker
-(void) SBPickerSelector:(SBPickerSelector *)selector cancelPicker:(BOOL)cancel;
- in your code add follow code when you need show the picker
SBPickerSelector *picker = [SBPickerSelector picker];
picker.pickerData = [@[@"one",@"two",@"three",@"four",@"five",@"six"] mutableCopy]; //picker content
picker.pickerType = SBPickerSelectorTypeText;
picker.pickerType = SBPickerSelectorTypeDate; //select date(needs implements delegate methid with date)
picker.onlyDayPicker = YES; //if i want select only year, month and day, without hour (default NO)
picker.datePickerType = SBPickerSelectorDateTypeOnlyHour; //type of date picker (complete, only day, only hour)
picker.delegate = self;
picker.doneButtonTitle = @"Done";
picker.cancelButtonTitle = @"Cancel";
[picker showPickerOver:self]; //classic picker display
[picker showPickerIpadFromRect:CGRectZero inView:self.view]; //if you whant a popover picker in ipad, set the view an point target(if you set this and opens in iphone, picker shows normally)
####feedback?
- twitter: @busta117
- mail: [email protected]
- http://www.santiagobustamante.info