nib但没有获得UITableView [英] nib but didn't get a UITableView
问题描述
我的应用程序适用于iOS 5.1,但对于iOS 6模拟器,我收到以下错误。
My application works for iOS 5.1 but for iOS 6 simulator I get the following error.
终止应用程序由于未捕获的异常
'NSInternalInconsistencyException',原因: - [的UITableViewController
的loadView]加载的MainListViewController 笔尖,但没有得到一个
的UITableView'。
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "MainListViewController" nib but didn't get a UITableView.'
我继承的UITableViewController
我不想改变它。
tableview是以编程方式创建的,有一个虚拟的 MainListViewController。 xib
从 Mainwindow.xib加载
标签栏控制器。
The tableview is created programmatically, there is a dummy MainListViewController.xib
to load from Mainwindow.xib
Tab Bar Controller.
我还尝试删除 MainListViewController.xib
,将其从 MainWindow.xib中删除
标签栏控制器,在AppDelegate中创建 MainListViewController
并将其添加到标签栏控制器为 UITabBarItem
摆脱这个笔尖问题,但我仍然得到同样的错误。
I also tried to delete MainListViewController.xib
, remove it from the MainWindow.xib
Tab Bar Controller, created the MainListViewController
in AppDelegate and added it to Tab Bar Controller as UITabBarItem
to get rid of this nib problem, but I still get the same error.
推荐答案
如果你有一个NIB用于 UITableViewController
子类然后其视图
outlet 必须连接到 UITableView
。
If you have a NIB for the UITableViewController
subclass then its view
outlet must be hooked up to a UITableView
.
你是正确的删除 MainListViewController.xib
并全部完成在代码中,但它不适合你的原因是因为你在构建时不会删除旧的XIB。跑。因此,从模拟器中删除应用程序,然后重试。它应该工作。
You're right to delete MainListViewController.xib
and do it all in code, but the reason it didn't work for you is because the old XIB will not be deleted when you build & run. So, delete the app from the simulator and try again. It should work then.
这篇关于nib但没有获得UITableView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!