如果用户未登录,我的应用程序有一个包含4个项目的TabBar。如果用户已登录,则TabBar有5个项目。 当用户启动应用程序时, didFinishLaunchingWithOptions 方法检查用户是否已登录:
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];
}
我的问题是:如何在登录/注销后添加/删除标签,例如: LoginViewController
答案 0 :(得分:1)
您是否尝试过UITabBarController方法?: - (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated