View outlet not set with UINavigationController
I have a NIB that contains a UINavigationController
which has a UIViewController
. The UIViewController
is being loaded externally from another nib. I am unable to set the view property thus I get the error:
*** Terminating app due to uncaught exception 'NSInternalInconsisten开发者_如何学运维cyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "LBRootViewController" nib but the view outlet was not set.'
How can I set my view property correctly?
You have a nib file of LBRootViewController.xib
. Inside that nib is a view controller subclass that has an outlet named view
. That outlet is not set.
When your (default name) MainWindow.xib
loads, it instantiates an instance of LBRootViewController
but then finds that the controller has no view outlet meaning it cannot display anything.
The nib you need to examine is LBRootViewController.xib
and not MainWindow.xib
.
If for some reason the LBRootViewController
object in LBRootViewController.xib
doesn't have a view property, then you have set the object to the wrong class i.e. something other than a UIViewController subclass.
I think you did not assign a 'view' property for the 'File's Owner' at the Interface Builder. (if file's owner is UIViewController)
精彩评论