【发布时间】:2015-11-23 19:45:19
【问题描述】:
所以我设置了 AppDelegate 来加载具有导航控制器的根视图 vc:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
SecondViewController *vc = [[SecondViewController alloc] init];
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:vc];
[self.window makeKeyAndVisible];
return YES;
在我的 SecondViewController 中,我有一个方法可以调用 push 来呈现第三个视图控制器:
ThirdViewController *thirdVC = [[ThirdViewController alloc]init];
[self.navigationController pushViewController: thirdVC animated:YES];
虽然这不起作用。仔细检查后,SecondViewController 上的 self.navigationController 属性为零。我在 AppDelegate 上是否遗漏了一些东西来使这个非零?
【问题讨论】:
-
尝试单独设置导航控制器并用视图控制器初始化,并使其成为根视图!
标签: ios objective-c xcode uinavigationcontroller