Latest 1.0.0
Homepage https://github.com/LaserSrl/LaserPicker
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit
Authors

CZPicker

CI Status
Version
License
Platform

Demo

LaserPicker

Change Log

3 most recent changes are listed here.

Full change logs

v0.4.3 – 2016-08-12

  • Added - (void)czpickerViewWillDisplay:(CZPickerView *)pickerView;
  • Added - (void)czpickerViewDidDisplay:(CZPickerView *)pickerView;
  • Added - (void)czpickerViewWillDismiss:(CZPickerView *)pickerView;
  • Added - (void)czpickerViewDidDismiss:(CZPickerView *)pickerView;
  • Added - (void)reloadData to reload picker.
  • Added - (void)showInContainer:(id)container.

v0.4.2 – 2016-04-12

  • Improve orientation handler to avoid unnecessary pop up animations.

v0.4.1 – 2016-04-10

  • Remove bundle resources setting in podspec file.

Usage

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

pod "CZPicker"

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

Swift

If you are using swift, please refer to swift demo project.

To show the picker, simply adding the following code:

CZPickerView *picker = [[CZPickerView alloc] initWithHeaderTitle:@"Fruits"
                        cancelButtonTitle:@"Cancel"
                        confirmButtonTitle:@"Confirm"];
picker.delegate = self;
picker.dataSource = self;
[picker show];

and implement the dataSource and Delegate methods:

#prama mark - CZPickerViewDataSource

@required
/* number of items for picker */
- (NSInteger)numberOfRowsInPickerView:(CZPickerView *)pickerView;

@optional
/*
 Implement at least one of the following method,
 czpickerView:(CZPickerView *)pickerView
 attributedTitleForRow:(NSInteger)row has higer priority
*/

/* attributed picker item title for each row */
- (NSAttributedString *)czpickerView:(CZPickerView *)pickerView
                            attributedTitleForRow:(NSInteger)row;

/* picker item title for each row */
- (NSString *)czpickerView:(CZPickerView *)pickerView
                            titleForRow:(NSInteger)row;

#prama mark - CZPickerViewDelegate
@optional
/** delegate method for picking one item */
- (void)czpickerView:(CZPickerView *)pickerView
          didConfirmWithItemAtRow:(NSInteger)row;

/** delegate method for picking multiple items,
 implement this method if allowMultipleSelection is YES,
 rows is an array of NSNumbers
 */
- (void)czpickerView:(CZPickerView *)pickerView
          didConfirmWithItemsAtRows:(NSArray *)rows;
/** delegate method for canceling */
- (void)czpickerViewDidClickCancelButton:(CZPickerView *)pickerView;

Customization

There are a lot of things can be customized, change the following properties to customize the picker of your own:

/** whether to show footer (including confirm and cancel buttons), default NO */
@property BOOL needFooterView;

/** whether allow tap background to dismiss the picker, default YES */
@property BOOL tapBackgroundToDismiss;

/** whether allow selection of multiple items/rows, default NO, if this
 property is YES, then footerView will be shown */
@property BOOL allowMultipleSelection;

/** picker header background color */
@property (nonatomic, strong) UIColor *headerBackgroundColor;

/** picker header title color */
@property (nonatomic, strong) UIColor *headerTitleColor;

/** picker cancel button background color */
@property (nonatomic, strong) UIColor *cancelButtonBackgroundColor;

/** picker cancel button normal state color */
@property (nonatomic, strong) UIColor *cancelButtonNormalColor;

/** picker cancel button highlighted state color */
@property (nonatomic, strong) UIColor *cancelButtonHighlightedColor;

/** picker confirm button background color */
@property (nonatomic, strong) UIColor *confirmButtonBackgroundColor;

/** picker confirm button normal state color */
@property (nonatomic, strong) UIColor *confirmButtonNormalColor;

/** picker confirm button highlighted state color */
@property (nonatomic, strong) UIColor *confirmButtonHighlightedColor;

/** picker's animation duration for showing and dismissing*/
@property CGFloat animationDuration;

Author

chenzeyu, [email protected]

License

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

Credits

CZPicker is created at and supported by Fooyo.sg

Latest podspec

{
    "name": "LaserPicker",
    "version": "1.0.0",
    "summary": "LaserPicker is a picker view shown as a popup.",
    "description": "LaserPicker is flexible. It is shown as a popup with customizations.",
    "homepage": "https://github.com/LaserSrl/LaserPicker",
    "license": "MIT",
    "authors": {
        "LaserPatrick": "[email protected]"
    },
    "source": {
        "git": "https://github.com/LaserSrl/LaserPicker.git",
        "tag": "1.0.0"
    },
    "social_media_url": "https://twitter.com/",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/*",
    "public_header_files": "Pod/Classes/*.h",
    "frameworks": "UIKit"
}

Pin It on Pinterest

Share This