Below is an example of using initWithNibName with separate xib views:
TerminalViewController *ctrl = [[TerminalViewController alloc]
initWithNibName:@"ControllerView" bundle:[NSBundle mainBundle]];
ctrl.appDelegate = self;
viewCtrl = ctrl;
However i need to implement it with a storyboard UI layout. For 'initWithNibName' how can i point to a View in my storyboard:
i.e. :
TerminalViewController *ctrl = [[TerminalViewController alloc]
initWithNibName:@"STORYBOARD.ControllerView" bundle:[NSBundle mainBundle]];
ctrl.appDelegate = self;
Any help is much appreciated. Thanks, Dave
You can give the controller an
Identifier
in the storyboard and then use this...Just to add to this...
When creating a
UIViewController
subclass from a xib file. If you have a class calledMyViewController
and a xib calledMyViewController.xib
then all you need to do is...The system will then look for a xib file called
MyViewController.xib
and use that to init the object and only fallback to doing it in code if the xib file doesn't exist.get storyboard instance with name of storyboard and set identifier to all scene and get the instance