I have an application with a login system. I want the tabBarController to change dynamically at runtime if the user login himself successfully! I have 5 tabs (Accueil, Tous les Voyants, Inscription, Connexion, Aide).
When the user hit the login button, I want to change Inscription to Achat Jetons and Connexion to Profile and link another ViewController to both of theses tabBarItems!
Right now, I've successfully managed to replace the title and image logo of my tab bar. But I don't know how to link the viewControllers to them! Here's what I got right now:
- (IBAction)BTN_ConnexionClick:(id)sender {
UITabBarController *tabBarController = (UITabBarController *)self.tabBarController;
UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:2];
UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:3];
[tabBarItem1 setFinishedSelectedImage:[UIImage imageNamed:@"menu_iOS_achat.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"menu_iOS_achat.png"]];
[tabBarItem2 setFinishedSelectedImage:[UIImage imageNamed:@"menu_iOS_profile.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"menu_iOS_profile.png"]];
tabBarItem1.title = @"Achat Jetons";
tabBarItem2.title = @"Profile";
}
I have created 2 new viewControllers via StoryBoard IB, I just don't know how to replace old linked viewController with new ones! Thanks for your help! :)