为什么在 didFinishLaunchingWithOptions 方法中需要以下行?
self.window.rootViewController = self.navigationController;
也就是说,请注意在 Interface Builder 中,在 MainWindow XIB 中,导航控制器及其导航栏和 RootViewController 在其层次结构中。
整个方法的副本供参考:
- (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;
}