문제

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