[英]Why do I get this error when trying to use presentViewController?
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "2Pv-MD-gdY-view-bDF-TR-G6E" nib but didn't get a UITableView.'
Why am I getting that? 我为什么得到那个? The gist of my app is that I have a UITableViewController with a button that triggers an action sheet. 我的应用程序的要旨是,我有一个UITableViewController,带有一个触发动作表的按钮。 The action sheet, when a specific option is pressed, then presents a view controller (modally). 当按下特定选项时,操作表将显示一个视图控制器(以模态形式)。 Here's my code: 这是我的代码:
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
NSString *buttonTitle = [actionSheet buttonTitleAtIndex:buttonIndex];
if ([buttonTitle isEqualToString:@"Text"]) {
AddTextViewController *addTextViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"addTextViewController"];
[self presentViewController:addTextViewController animated:YES completion:nil];
}
} }
I can supply any further needed information, but I'm not sure what's going wrong. 我可以提供任何其他需要的信息,但是我不确定出什么问题了。
Did you create a view in a xib for this table view controller? 您是否在xib中为此表视图控制器创建了视图? You probably just need to connect the tableView property in the xib file to a tableView. 您可能只需要将xib文件中的tableView属性连接到tableView。
It looks like you're trying to instantiate a nib and it isn't present. 看来您正在尝试实例化笔尖,但它不存在。 Is the nib included as a project member? 笔尖是否包含在项目成员中?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.