在我的通用 iPhone/iPad 应用程序中,当我尝试在模态视图中显示操作表时,仅在 iPad 上发生崩溃。当我在主视图中时它不会崩溃。这个过程是这样的:
(用户点击按钮呈现模态视图)
-(IBAction)showModal:(id)sender {
modalController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:modalController animated:YES];
}
(然后,在指定的时间调用一个函数,然后调出一个 UIActionSheet)
actionSheet = [[UIActionSheet alloc] initWithTitle:@"Alarm"
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:@"Dismiss"
otherButtonTitles:nil];
[actionSheet showInView:self.view];
这给了我以下错误:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: view != nil'
有谁知道为什么我只在 iPad 上遇到此错误?谢谢!
最佳答案
你不应该使用吗?:
UIActionsheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Alarm"
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:@"Dismiss"
otherButtonTitles:nil];
[actionSheet showInView:[self view]];
关于objective-c - UIActionSheet showInView 上的 iPad NSInternalInconsistencyException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5123261/