OGeek|极客世界-中国程序员成长平台

标题: ios - 将 UIViewController 更改为 UITableViewController [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 04:31
标题: ios - 将 UIViewController 更改为 UITableViewController

我有 iOS 应用程序,它是主从 View 应用程序。默认是masterview tableview,detailview是经典UIViewController。现在,我需要将 UIViewController 更改为 UITableViewController,所以我在 detailViewController.h 中更改了这个

@interface DetailViewController : UIViewController

进入这个:

@interface DetailViewController : UITableViewController

在 .xib 文件中,我已将自定义类设置为 DetailViewController,所以它应该可以工作...但它没有...当我尝试运行应用程序时,它返回一个错误:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "DetailViewController" nib but the view outlet was not set.'

请问哪里有问题?非常感谢!



Best Answer-推荐答案


您必须在 xib 文件中删除您的 View Controller 对象,并从 Utilities 选项卡中使用它们的 UITableViewController。所以在代码中改变子类是不够的,你还需要确保你在 xib 中使用了正确的模板。

关于ios - 将 UIViewController 更改为 UITableViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19327500/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4