为什么在didFinishLaunchingWithOptions方法中需要以下行?为什么在Xcode 4 Navigation Based App中需要“window.rootViewController = self.navigationController”?
self.window.rootViewController = self.navigationController;
也就是说,关注的是已经出现在Interface Builder中,在主窗口厦门国际银行,它的导航控制器的导航栏和RootViewController的范围内它的层次结构。参考整个方法的
Copy是:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// Add the navigation controller's view to the window and display.
self.window.rootViewController = self.navigationController;
[self.window makeKeyAndVisible];
return YES;
}
如果您在IB中使用MainWindow.xib创建正确的附件,则可以安全地删除该行代码。 – m4rkk 2011-10-23 15:51:53