Another way to go about this is to simply hide the navigation bar in your root controller:
- (void) viewDidLoad {
...
if (![self.navigationController isNavigationBarHidden])
[self.navigationController setNavigationBarHidden:YES animated:NO];
...
}
That way, you have a nice, clean root controller with no navigation bar in the way.
When you click on a button in your root controller, you simply push in a new view and un-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 some notification or other action that brings you back to the root view controller, just hide the notification bar again:
- (void) viewWillAppear:(BOOL)animated {
if (![self.navigationController isNavigationBarHidden])
[self.navigationController setNavigationBarHidden:YES animated:YES];
[super viewWillAppear:animated];
}