Xcode “-[UIViewController _loadViewFromNibNamed:bundle:] loaded the nib but the view outlet was not set.” error

感情迁移 提交于 2019-12-01 03:22:37

Are you sure you have a UIView (or subclass) assigned to the "view" property of PonyboardViewController? Right click on "File Owner" in the left pane of the xib for PonyboardViewController and verify that the "view" outlet is set.

If not, set it to a view!

I just have the same problem as you, so I fixed it like that: this is my code block:

self.chatsView = [[ChatsView alloc] initWithNibName:@"ChatsView" bundle:nil];

I click ChatsView.xib to find the "File's owner", then hover my mouse over the "File's owner", and right click, that will prompt something like this:

The unconnected 'view' outlet

you must drag the "view" Outlet to connect to the View which have two subViews: Search Bar&Table View in my xib file.

The connected 'view' outlet

A.G

Your problem probably lies with the XIB or Stroyborad scene. Check whether the View is connected properly to the class.

I've tried, and it works fine for me after doing it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!