gpt4 book ai didi

ios - 嵌套的 ActionSheetPicker,另一个完成 block 内的选择器

转载 作者:行者123 更新时间:2023-11-29 12:34:47 24 4
gpt4 key购买 nike

我刚遇到无法嵌套 ActionSheetPickers 的障碍。我正在使用 iOS 库 ActionSheetPicker-3.0由 Tim Cinel 开发,非常有效。但是,当我想嵌套多个选择器时,我遇到了一个问题。我想要做的是一个一个地显示三个操作表选择器(在用户点击完成按钮后,另一个应该显示)。第一个选择器将毫无问题地显示,但第二个选择器将出现并立即消失。这是我的代码

[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]];

任何帮助将不胜感激,非常感谢!

最佳答案

好的,我收到了这个库的原作者的回复。

这是他的解释:

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.

之后我尝试了他建议的解决方案

[self performSelector:@selector(second:) withObject:sender afterDelay:0.4];

然后一切都像一个魅力:-)

关于ios - 嵌套的 ActionSheetPicker,另一个完成 block 内的选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26666419/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com