有很多关于UINavigationController
. 我修改了我的代码以遵循 Apple 示例,但该pushViewController
方法不起作用:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[window addSubview:navController.view];
[window makeKeyAndVisible];
LoginController *login = (LoginController*)[self.navController.viewControllers objectAtIndex:0];
if([login already_validated] == TRUE) {
self.timeline = [[TimelineViewController alloc] initWithNibName:@"Timeline" bundle:[NSBundle mainBundle]];
[navController pushViewController:timeline animated:YES];
[self.timeline release];
}
return YES;
视图在以下行中正确加载:
self.timeline = [[TimelineViewController alloc] initWithNibName:@"Timeline" bundle:[NSBundle mainBundle]];
...但
[navController pushViewController:timeline animated:YES];
不呈现视图。我已经检查过并且navController
不为空。
有任何想法吗?
最好的!
卢卡斯。
固定的!!
问题出在MainWindow.xib
.
不要rootViewController
在窗口类上设置!
如果您在 XIB 文件上设置属性,则此视图将位于其他所有内容之上。