简体   繁体   English

为什么在尝试使用presentViewController时出现此错误?

[英]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.

相关问题 为什么我在尝试移动鼠标时会出错? - Why do I get an error when trying to move the mouse? 尝试检查是否在Corona SDK中时为什么会出现此错误? - Why do i get this error when trying to check if in Corona sdk? 为什么在尝试编译此代码时会出现错误“error:unknown type name'virtual'”? - Why do I get the error “error: unknown type name 'virtual'” when trying to compile this code? 在Swift中,为什么尝试Println textfield.text时出现错误 - In Swift, why do I get an error when trying to Println textfield.text 为什么在尝试重新加载数据时总是出现索引超出范围错误? - Why do I always get an Index out of range error, when trying to reload data? 为什么尝试返回从Parse.com提取的UIImage时出现此错误? - Why do I get this error when trying to return a UIImage fetched from Parse.com? 为什么当我使用self.presentViewController(vc,动画:true,完成:nil)时黑屏Xcode swift 2 - Why am I getting a black screen when I use self.presentViewController(vc, animated: true, completion: nil) Xcode swift 2 为什么在尝试将addObject添加到NSMutableArray时会收到SIGABRT - Why do I get SIGABRT when trying to addObject to NSMutableArray 使用presentViewController时未调用viewDidDisappear - viewDidDisappear not called when use presentViewController 为什么我在使用 MVP 时在 Presenter 中得到 nil? - Why do I get nil in presenter when I use MVP?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM