【发布时间】:2014-08-26 16:37:17
【问题描述】:
我相信这是一个 iOS8 错误,但我不确定。我可以通过一个简单的项目轻松重现它。
在 iOS8 上,我以模态方式将视图控制器呈现为表单,然后在该表单中显示操作表。
- (IBAction)showActionSheet:(id)sender {
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:@"How can I stop the modal formsheet from being dismissed with the actionsheet?"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:@"Destructive"
otherButtonTitles:@"Another Button",nil];
[actionSheet showInView:self.view];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
// Confirmation message is specific to the filter applied
NSLog(@"clicked %d",buttonIndex);
}
当此操作表根据用户选择自动关闭时,它也会关闭显示它的视图控制器。有趣的是,如果您在操作表之外点击,它会被关闭,但不会带上视图控制器。
有没有办法解决这个问题?也许是一种在操作表外“伪造”点击的方法?
这是一个演示该行为的简单测试项目:https://www.dropbox.com/s/kecyi4egpckwn69/ActionsheetIssueTest.zip?dl=0
【问题讨论】:
-
我也看到了。您是否记录了 Apple 的错误?
-
根据开发者论坛已经打开了一个雷达。我从来没有解决过这个问题,但是直接使用 iOS8 UIAlertController 不会发生。所以我最终在带有 Actionsheet 设置的 UIAlertController 和直接 UIActionsheets 之间切换。
-
谢谢。我也切换到 UIAlertController,但如果他们修复了这个 bug,那就太好了。
标签: objective-c ipad ios8 uiactionsheet