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

有帮助吗?

解决方案

Did you try UITabBarController method?:
- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top