Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use didConfirmWithItemsAtRows for selecting multiple items #34

Closed
uniruddh opened this issue Apr 15, 2016 · 3 comments
Closed

Comments

@uniruddh
Copy link

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?

@chenzeyu
Copy link
Owner

let me test out.

@chenzeyu
Copy link
Owner

chenzeyu commented Apr 15, 2016

@Astuter if you integrate CZPicker using cocoapods in a Swift project, you can click into the CZPickerViewDelegate header file, where the content is as follows:

public protocol CZPickerViewDelegate : NSObjectProtocol {

    /** delegate method for picking one item */
    optional public func czpickerView(pickerView: CZPickerView!, didConfirmWithItemAtRow row: Int)

    /*
     delegate method for picking multiple items,
     implement this method if allowMultipleSelection is YES,
     rows is an array of NSNumbers
     */
    optional public func czpickerView(pickerView: CZPickerView!, didConfirmWithItemsAtRows rows: [AnyObject]!)

    /** delegate method for canceling */
    optional public func czpickerViewDidClickCancelButton(pickerView: CZPickerView!)
}

Therefore, you should use [AnyObject]! instead of Array. I just created a swift demo, you can refer to that project.

@uniruddh
Copy link
Author

@chenzeyu 👍 Thanks yes that helped !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants