1

如果用户未登录,我的应用程序有一个包含 4 个项目的 TabBar。如果用户已登录,则 TabBar 有 5 个项目。当用户启动 App 时,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

4

1 回答 1

1

您尝试过 UITabBarController 方法吗?:
- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated

于 2013-11-02T01:58:49.860 回答