title: iOS app with tabbar and navigation controller
body: <p>In the struggle of creating my first iPhone app I noticed that the examples from Apple either have a tabbar or navigation bar, but never both.</p>
  
  <p>Is it possible to do this?</p>
  
  <p>So I have here a tabbar with 3 buttons, how can I now add a navigation controller to my entire application?</p>
  
  <pre><code>self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
  
  UIViewController *activityViewController = [[[ActivityViewController alloc] initWithNibName:@"ActivityViewController" bundle:nil] autorelease];
  UIViewController *agendaViewController = [[[AgendaViewController alloc] initWithNibName:@"AgendaViewController" bundle:nil] autorelease];
  UIViewController *settingsViewController = [[[SettingsViewController alloc] initWithNibName:@"SettingsViewController" bundle:nil] autorelease];
  
  self.tabBarController = [[[UITabBarController alloc] init] autorelease];
  self.tabBarController.viewControllers = [NSArray arrayWithObjects:activityViewController, agendaViewController, settingsViewController, nil];
  self.window.rootViewController = self.tabBarController;
  [self.window makeKeyAndVisible];
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I'm really not following, so in my appdelegate I created a navigationController and used that as the rootViewController.</p>
  
  <p>I then created a tabBarController and added this to my window</p>
  
  <pre><code>self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
  
  UINavigationController *mainViewController = [[UINavigationController alloc] init];
  self.mainViewController = [[UINavigationController alloc] initWithRootViewController:mainViewController];
  self.window.rootViewController = self.mainViewController;
  [self.window makeKeyAndVisible];
  
  self.window.rootViewController.title = @"test";
  
  MainViewController *tabBarController = [[MainViewController alloc] init];
  [self.window addSubview:tabBarController.view];
  </code></pre>
  
  <p>But whenever I run, I get the error"</p>
  
  <blockquote>
    <p>Pushing a navigation controller is not supported</p>
  </blockquote>
  
  <p>Am I still missing something?</p>