Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In your UINavigationController subclass you need to instantiate your view controller with its view in a NIB(let's call it NIBViewController) and set that view controller as the rootViewController with the method <code>setViewControllers:animated:</code>. Do it in <code>awakeFromNib</code> like this:</p> <pre><code>- (void)awakeFromNib { [super awakeFromNib]; NIBViewController *viewController = [[NIBViewController] init];// It will look for the appropriate XIB as long as you did not change its name and it's in the main bundle, otherwise use initWithNibName:bundle: [self setViewControllers:@[viewController] animated:NO]; } </code></pre> <p>Then, to go from the NIBViewController to other view controller contained in the storyboard just set an identifier in the storyboard for that view controller, instantiate it and push it or present it, as you want.</p> <p>It is important to mark that in your NIBViewController instance self.storyboard will be nil because that view controller is not contained in a storyboard, so you need to instantiate a new storyboard(solution A**) or get the storyboard from the navigation controller(solution B):</p> <pre><code>// Solution A UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; // Solution B UIStoryboard *storyboard = [self.navigationController storyboard]; UIViewController *storyboardViewController = [storyboard instantiateViewControllerWithIdentifier:@"viewControllerId"]; [self.navigationController pushViewController:storyboardViewController animated:YES]; </code></pre> <p>** Please note that this is creating a new instance of the storyboard, so better not to try tricky things and avoid segues to previous view controllers contained in the storyboard or you will find that those view controllers are not the same ones... It's the first solution that came to my mind, but definitely you should go for the solution B.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload