带有表格视图的导航控制器
我正在尝试创建一个带有导航模板的多视图应用程序。我希望表格位于初始视图的底部,其他视图(图像视图、标签等)位于顶部。按照之前的建议,我修改了 RootViewController.xib 以添加 UIView,然后将表视图移至该视图。另外,按照建议,我将文件所有者的视图连接设置为新视图,而不是表视图。 但是,当我启动该应用程序时,它崩溃并显示消息:
'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "RootViewController" nib but didn't get a UITableView.'
有人可以帮忙并指出我正确的方向吗?我将不胜感激!
I am trying to create a multi-view app with navigation template. I want table on the bottom part of initial view, with other views (image view, labels, etc) on the top. As previously recommended, I modified RootViewController.xib to add UIView, then moved table view to that view. Also, as recommended, I set view connection of File's Owner to new view, rather than tableview.
However, when I launch the app, it crashes with message :
'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] loaded the "RootViewController" nib but didn't get a UITableView.'
Can someone please help and point me in the right direction? I would be muchly appreciative!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我不是专家,但我遇到过这个问题几次。我解决这个问题的方法是从右侧栏中添加一个 TableView 控制器,这为您提供了一个已经与 Table View 一起的表视图控制器,因此您唯一需要做的就是在其中设置自定义类。再说一遍,我不是专家,但这使该消息消失了,希望它有所帮助。
更新:只是想重申 SVD 指出的,您需要一个新的出口,而不是附带的出口,即“视图”出口,否则表的数据将不会显示。
Ok I'm not an expert but I encountered this problem a few times. What I did to solve it was to add a TableView Controller from the right bar, this gives you a Table View Controller already together with a Table View, so the only thing you have to do is set your custom class in it. Once again I'm no expert but this made the message go away, hope it helps.
UPDATE: just wanted to reiterate what SVD pointed out, you need to have a new outlet instead of the one that comes with it, the 'view' one, otherwise the data for the table won't show.