title: Cocoa - Adding a Navigation Controller to a subview
body: <p>I'm currently working on a view based app for the iPad that has 3 seperate views on the main page. A custom menu up the top, a status list on the side, and a main view. The issue I am having with the main view is trying to add a navigation controller.</p>
  
  <p>In AppPadViewController.h</p>
  
  <pre><code>@interface AppPadViewController.h : UIViewController {
      MainViewController *MainView;
  }
  
  @property (nonatomic,retain) IBOutlet MainViewController *MainView;
  </code></pre>
  
  <p>And in AppPadViewController.m</p>
  
  <pre><code>@synthesize MainView;
  
  - (void) viewDidLoad {
      [super viewDidLoad];
  
      MainView.navigationItem.title = @"Home";
      UINavigationController *mainNavController = [[UINavigationController alloc] initWithNibName:@"MainView" bundle:[NSBundle mainBundle]];
  
      self.MainView = [MainViewController alloc] initWithRootViewController:mainNavController];
  }
  </code></pre>
  
  <p>And in the nib I have added the view where I would like it, and tied it in to the MainView, and then added the MainViewController and tied it to the File Owner and view.</p>
  
  <p>When I run this, I get an 'Unrecognized Selector" error thrown on the initWithRootViewController line.</p>
  
  <p>Can anyone see any problem with the code, or suggest a better way to add a navigation controller to a sub view?</p>