我刚刚遇到了一个障碍,我不能筑巢ActionSheetPickers。我正在使用由Tim开发的iOS库ActionSheetPicker-3.0,它非常有效。然而,当我想要嵌套多个采摘者时,我遇到了一个问题。我想要做的是一个一个地显示三个操作页选择器(在用户点击“完成”按钮后,另一个应该显示)。第一个选择器将显示没有问题,但第二个将出现并立即消失。这是我的密码
[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]];任何帮助都将不胜感激,非常感谢!
发布于 2014-11-04 23:46:49
好的,我收到了这个库的原作者的回复。
以下是他的解释:
所以,在按下按钮和选择器之后立即停止调用,还没有隐藏。这就是为什么新的挑选者没有崛起的原因。因为这不是第一次有人问起这个案子--我会尽快解决这个问题。 现在,作为解决办法-你可以等待0.3秒后,才能提出新的选择。
在那之后,我尝试了解决办法,他建议。
[self performSelector:@selector(second:) withObject:sender afterDelay:0.4];然后一切都像魅力一样运作:)
https://stackoverflow.com/questions/26666419
复制相似问题