Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I also wanted to include the navigation controller in the NIB file, but all that the Apple documentation said was that it is "not optimal" without actually explaining how to do it. I wanted my main tabbed window to call up a modal window containing the typical navigation controls without defining the navigation controller programmatically. I'll share how I did it.</p> <p>Your code was very similar to mine, as I also defined an <code>IBOutlet UINavigationController *navigationController</code> in MyViewController. From Interface Builder, I simply defined my view in the root view controller and set the File's Owner->view to that view definition. </p> <p>And similarly to your code, I did the following in my parent window:</p> <pre><code>MyViewController *myViewController = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:nil]; [self presentModalViewController:myViewController animated:YES]; </code></pre> <p>(I am calling presentModelViewController on self, I don't know why you had <code>self.navigationController</code>.) When I tested this, the result was that my view was loaded from the NIB file, but the navigation bar was missing. One more line of code in MyViewController fixed this:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; [self setView:myNavigationController.view]; } </code></pre> <p>All I am doing here, is setting MyViewController's view to point to myNavigationController.view, which contains everything that was defined in the NIB file, including the navigation controller.</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.
    3. VO
      singulars
      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