Did you try UITabBarController method?:
- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated
add TabBar Item after login
-
03-07-2022 - |
题
My app has a TabBar with 4 items if the user is not logged. If the user is logged in, the TabBar has 5 items. When the user start the App, the didFinishLaunchingWithOptions method check if the user is logged in:
ShoutboxViewController *viewController1 = [[ShoutboxViewController alloc] initWithNibName:@"ShoutboxViewController" bundle:nil];
UINavigationController *view1 = [[UINavigationController alloc] initWithRootViewController:viewController1];
...
self.tabBarController = [[UITabBarController alloc] init];
if (login == TRUE) {
self.tabBarController.viewControllers = [NSArray arrayWithObjects:view1, view4, view3, view5, view2, nil];
} else {
self.tabBarController.viewControllers = [NSArray arrayWithObjects:view1, view4, view3, view2, nil];
}
My Question is: how can i add/remove a tab after login/logout in e.g. LoginViewController
解决方案
不隶属于 StackOverflow