1

我在导航控制器中有一个标签栏控制器。我想根据用户是否登录来更改导航控制器的根视图。我该怎么做?我不想将代码didFinishLaunchingWithOptions:或任何其他 AppDelegate 方法放入其中,因为它不会是用户首先看到的内容。

4

1 回答 1

1

你是对的,它应该是:

- (void) goNext {
NextViewController* nextWindow = [[NextViewController alloc] initWithNibName:@"NextView" bundle:nil];
[self.navigationController setViewControllers:[NSArray arrayWithObject:nextWindow] animated:YES];
}

由于无法弹出根视图控制器,因此可以改用以下方法:

- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated

这是此方法的苹果文档的链接 。

于 2013-08-13T16:05:17.573 回答