Je développe une application pour iOS5 et plus et je n'utilise pas de story-boards ou IB. Je crée un UITabBarController
personnalisé et dans mon AppDelegate
je mets dedans 4 contrôleurs de vue avec seulement 1 UINavigationController
(ne peut pas dire pourquoi).UITabBarController et UINavigationController personnalisés
Il en résulte un comportement où je peux pousser nouveau VC seulement à partir du premier onglet , qui est apparemment, dans une si UINavigationController
appelé navController
:
SGTabBarController *tabBarController = [[SGTabBarController alloc] init];
SGHomeViewController* vc1 = [[SGHomeViewController alloc] init];
SGChooseOSAgainViewController* vc3 = [[SGChooseOSAgainViewController alloc] init];
SGSmsServicesViewController* vc4 = [[SGSmsServicesViewController alloc] init];
SGSupportViewController *vc5 = [[SGSupportViewController alloc] init];
navController = [[UINavigationController alloc] initWithRootViewController:vc1];
NSArray* controllers = [NSArray arrayWithObjects:navController, vc3, vc4, vc5, nil];
tabBarController.viewControllers = controllers;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = tabBarController;
[navController setNavigationBarHidden:YES animated:NO];
[self.window makeKeyAndVisible];
Pourquoi? Devrais-je créer un UINavigationController
distinct pour chaque onglet? J'ai pris ce code dans la documentation d'Apple.
Parfait! Je vais essayer et rapporter! –