Reputation: 2565
What is the correct way to manually add a xib file i.e. if while creating the class, we uncheck "With XIB for interface"...then how do we connect both the IB & VC.m file later, to ensure that the view gets loaded from xib ?
Upvotes: 2
Views: 2240
Reputation: 14562
To allow setting actions and outlets at design time in IB, once you create the xib file, change File Owner to your controller class. To do this, in IB, with File Owner selected, press Command-4.
Upvotes: 1
Reputation: 43815
Typically this is done when you instantiate your sub-classed UIViewController. Your call would look something like this:
MyViewController *viewController = [[MyViewController alloc]
initWithNibName:@"NibName" bundle:nil];
Checkout UIViewController initWithNibName: bundle: documentation for more details. You can also look at the documentation on Custom View Controllers for a good bit of information on sub-classing UIViewControllers.
Upvotes: 3