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

Run picker within done block of another #84

Closed
qiuyujx opened this issue Nov 3, 2014 · 3 comments
Closed

Run picker within done block of another #84

qiuyujx opened this issue Nov 3, 2014 · 3 comments

Comments

@qiuyujx
Copy link

qiuyujx commented Nov 3, 2014

I met a problem when I want to nest multiple pickers. What I want to do is showing three action sheet pickers one by one (after user tapped done button, another should show). The first picker will be shown without problems, but the second one will appear and immediately disappear. Here is my code:

[ActionSheetDatePicker showPickerWithTitle:@"Choose Date" datePickerMode:UIDatePickerModeDate selectedDate:[NSDate date] doneBlock:^(ActionSheetDatePicker *picker, NSDate *selectedDate, id origin) {
// update choosed date
[self updateInspectionDate:selectedDate atIndexPath:indexPath];
[self.tableView reloadData];
// start another action sheet for start time
[ActionSheetDatePicker showPickerWithTitle:@"Start Time" datePickerMode:UIDatePickerModeTime selectedDate:[NSDate date] doneBlock:^(ActionSheetDatePicker *picker, NSDate *selectedDate, id origin) {
// update start time
[self updateInspectionStartTime:selectedDate atIndexPath:indexPath];
[self.tableView reloadData];
// start another action sheet for end time
[ActionSheetDatePicker showPickerWithTitle:@"End Time" datePickerMode:UIDatePickerModeTime selectedDate:[NSDate date] doneBlock:^(ActionSheetDatePicker *picker, NSDate *selectedDate, id origin) {
// update choosed time
[self updateInspectionEndTime:selectedDate atIndexPath:indexPath];
[self.tableView reloadData];
} cancelBlock:nil origin:[tableView cellForRowAtIndexPath:indexPath]];
} cancelBlock:nil origin:[tableView cellForRowAtIndexPath:indexPath]];
} cancelBlock:nil origin:[tableView cellForRowAtIndexPath:indexPath]];

If this is not possible, is there anyway to put 3 ActionSheetDatePickers within one action sheet view?
Any help will be appreciated, thanks a lot!

@skywinder
Copy link
Owner

Hi! It's the same problem that described here: #63
So, done block calls right after button pressed and picker not hidden yet. That's why new picker is not rise up.
Since it's not the first time, that someone ask about this case - I'll try to resolve this issue soon.

Now, as workaround - you can wait for 0.3 seconds before rise up new picker. (as I described in #63)

@qiuyujx
Copy link
Author

qiuyujx commented Nov 3, 2014

Thanks a lot. That helped me a lot!

skywinder added a commit that referenced this issue Nov 4, 2014
skywinder added a commit that referenced this issue Nov 4, 2014
skywinder added a commit that referenced this issue Nov 4, 2014
skywinder added a commit that referenced this issue Nov 4, 2014
skywinder added a commit that referenced this issue Nov 4, 2014
skywinder added a commit that referenced this issue Nov 4, 2014
@skywinder
Copy link
Owner

Good news everyone! Since version 1.3.1 you don't have to wait 0.3 seconds! Just call next picker from done block!

@skywinder skywinder changed the title Can I nest ActionSheetPickers, i.e. picker within done block of another Run picker within done block of another Nov 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants