How to load a XIB with a top-level ViewController?
问题 I've got a nib with a view controller root element like this: so I can position elements relative to the top and bottom layout guides using auto-layout. When I first tried to load this nib using SearchViewControllerPro* searchViewController = [[SearchViewControllerPro alloc]initWithNibName:@"SearchViewControllerPro" bundle:[NSBundle mainBundle]]; I got the following run-time exception: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController