Git Product home page Git Product logo

czpicker's Introduction

CZPicker

CI Status Version License Platform

Demo

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

czpicker's People

Contributors

chenzeyu avatar gokhanakkurt avatar pushchris avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

czpicker's Issues

Multi Line Text

When any option have big text then it doesn't show full text and "..." shows at the end.
Is it possible to increase number of lines of picker options?

orientation issue

There is an issue with the orientation of the picker. To simulate do the following:
Open the app in portrait and tap to open the picker.
Then rotate the device. You will see that it does not show correctly.

Thanks for the library.

Non-selectable / greyed out option?

Is there a way to set X many rows as non-interactive? Or 'force select/unselect'?

I'm using setSelectedRows for passing a few pre-selections I want already ticked. I was wondering if there's a way to make them (or a subset) non-active so the user can't select/unselect them.

CZPicker not showing on iPad (Swift)

I am presenting Picker on iPad and iPhone (physical devices). On iPhone Picker appears on iPad don't. I checked and all methods get called properly. I am using different Storyboards, so maybe some problem with that?

Pass options to 'preselect'

Hi,

Is there a way to present a modal with certain options already selected by default?
If not, how would you go around implementing this? I don't mind putting in the work and making a PR later on.

Remember last select row ;)

Hello,
thanks for your excellent work.
I wanted to know if there is a way to recall the previous active selection.
Eg. By calling the "selectRow"
Thank You.

Change the data label font type and size

Hi CZ, thanks for this awesome picker. BEST CUSTOM CONTROL FOR PICKER EVER! -

Anyway, I'd like to request a feature or can you tell me a way to change the label's font type and size? My strings to be displayed in the picker are quite long.

Thanks.
G

Need an option to select multiple items/rows.

Hi Chenzeyu, Love the work and effort you have put into this component. It just looks production ready and you seem to have put in lots of thought into making it customizable. I have one minor request to allow selection of multiple rows.

Thanks

Option to provide pre-selected items

Currently there is no way to provide pre-selected items.

Possible use case:
If we save selected options on backend, then ideally Picker should be loaded with pre-selected options.

Issue with exporting IPA

[MT] Presenting: Error Domain=IDEFoundationErrorDomain Code=1 "Info.plist of “App.app/Frameworks/CZPicker.framework” specifies a simulator platform for the CFBundleSupportedPlatforms key" UserInfo={NSLocalizedDescription=Info.plist of “App.app/Frameworks/CZPicker.framework” specifies a simulator platform for the CFBundleSupportedPlatforms key}

how to load data picked

I just picked data, I want pick again. when picker show I want checkmark for my data picked.
Excuse me for translate.

Need to handle case: selectedIndexPath

First off all i have to say this is very nice popup view (Thank you!)

Because of we can use this popup for multiple selection functions in view.
Example: use 1 picker for all case ~
button 1 - handle selection Name
button 2 - handle selection Sex
button 3 - handle selection Locations

IF
we select option 2 for case of Button 1
then we touch on Button 2 -> selection check mark will be option 2 but we(user) did not do anything

Therefore, i think we should use 1 flag for this checking: should remember last selection or not.

Anyway, we can handle this issue by create multiple picker (but i think it is not good idea enough ~from my self)

:) Thank you! This is really nice popup view.
Sorry if i have some grammar problem.

Orientation Issue

I found an issue about orientation on Portrait app.
I set project configure as Portrait orientation only.
But every times I rotate an app. CZPicker view will animate in again.

Using CZPicker (0.3.2)

Change Header Title dynamically

Is there a way to change the title dynamically? I would like to use this component on the same controller for multiple purposes

set maximum number of items

Hi, Thanks for the great picker

I want to set a maximum number of items that the user can select and display a message when he select an item and reach the max.

For now I'm handling this through didConfirmWithRows and show the picker again if the max is reached/exceeded, but it would be kind of confusing since you have to go through the whole list again to unselect.

Is there a way or a delegate method that I missed that can do this ?

Thanks.

Presentation Duration

I think it would be good if you can specify the time it takes to present. At the moment its too fast(IMO) and I would prefer to specify the duration to present.

Unable to use didConfirmWithItemsAtRows for selecting multiple items

I want to let use select multiple item in my PickerView.

func czpickerView(pickerView: CZPickerView!, didConfirmWithItemsAtRows rows: Array!) { }

If I use delegate method as above, I am getting both warning and error as shown in below image:

error

Changing method to following remvoes the warning but error is still there:
@objc func czpickerView(pickerView: CZPickerView!, didConfirmWithItemsAtRows rows: Array) { }

What I'm missing for this method?

How to Hide popup automatically when socket refresh

Hi,

I am showing popup when get some response from socket. But in this scenario i want to hide without touch the popup will close while get another response from socket... How to do this one.. I tried button cancel action. But its not working.. Kindly help us..

i create this function in CZPickerView.m

  • (void)hide {
    [self cancelButtonPressed:self];
    [self buildBackgroundDimmingView];
    }

Thans
Krishna

Support clear background view

Currently the picker is dimming the background to a very dark grey.
From usability perspective I always prefer to have the screen from which the picker is called to be visible.
Having a dimmed background without the application screen visible breaks the visual flow of an application - pickers should just pop up and vanish from my perspective.

An change to have a switch allowing to disable the dimming / colouring of the view - ideally completely removing it but keeping the cancel functionality when clicking outside of he picker list alive ?.

Perfect solution would be to be able to present the picker from a control (rect) , just showing it as a popup instead of a modal view.

How to change the height of the Picker?

Hi,

When we add a lot of elements to the picker, it shows a very long picker view. I want to set how much height the picker can take. Is there a way? If not, can it be made a feature request?

how to add an optional search bar.!

With an optional search bar on top of the the table view, the CZPicker will be optimized for using in large lists. I currently use it with lists having 10-200 items. and It will be awesome if it will be supported in a later version.

Swift Demo

initWithHeaderTitle cant call in swift.

Please give a sample.

Select all options

Hi , Instead of cancel I will be adding select all button. And can u give me the code for selecting all values in your picker. Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.