我正在做CS193P斯坦福大学的课程教程和一些苹果iOS开发教程,他们把ViewController推到屏幕上的方式是有区别的
苹果做到了这一点:
UINavigationController *aNavigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
self.navigationController = aNavigationController;斯坦福大学建议这样做:
navigationController = [[UINavigationController alloc] init];
[self.navigationController pushViewController:rootViewController animated:NO];它们有什么不同?
顺便说一句,苹果的方法有效,而斯坦福的方法没有显示任何东西,我不知道为什么。
发布于 2011-07-01 05:32:54
我认为使用pushViewController:animated方法可以将控制器添加到控制器堆栈的顶部(push a new view controller on the stack)。
在第二种方法中,您没有初始化navigationController。
https://stackoverflow.com/questions/6541260
复制相似问题