Une autre façon d'aller à ce sujet est tout simplement de masquer la barre de navigation dans votre contrôleur racine:
- (void) viewDidLoad {
...
if (![self.navigationController isNavigationBarHidden])
[self.navigationController setNavigationBarHidden:YES animated:NO];
...
}
De cette façon, vous avez un contrôleur racine agréable, propre sans barre de navigation de la manière.
Lorsque vous cliquez sur un bouton dans votre contrôleur racine, vous appuyez simplement dans une nouvelle vue et non cacher la barre de navigation:
- (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];
}
Si vous avez une notification ou toute autre action qui vous ramène à le contrôleur de vue racine, il suffit de masquer la barre de notification à nouveau:
- (void) viewWillAppear:(BOOL)animated {
if (![self.navigationController isNavigationBarHidden])
[self.navigationController setNavigationBarHidden:YES animated:YES];
[super viewWillAppear:animated];
}