Another way to do this is to simply hide the navigation bar in the root controller:
- (void) viewDidLoad { ... if (![self.navigationController isNavigationBarHidden]) [self.navigationController setNavigationBarHidden:YES animated:NO]; ... }
This way you have a clean, clean root controller without a navigation bar.
When you press the button in the root controller, you simply enter a new view and hide the navigation bar:
- (IBAction) pushAnotherView:(id)sender { AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherViewController" bundle:nil]; [self.navigationController pushViewController:anotherViewController animated:YES]; if ([self.navigationController isNavigationBarHidden]) [self.navigationController setNavigationBarHidden:NO animated:YES]; [anotherViewController release]; }
If you have a notification or other action that returns you to the root view controller, just hide the notification panel again:
- (void) viewWillAppear:(BOOL)animated { if (![self.navigationController isNavigationBarHidden]) [self.navigationController setNavigationBarHidden:YES animated:YES]; [super viewWillAppear:animated]; }
source share