self.window.rootViewController = self.tabBarController;
[self.window addSubview:self.tabBarController.view];
它們在下面的上下文中使用:下面兩條陳述有什麼區別?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
// Add the tab bar controller's current view as a subview of the window
// self.window.rootViewController = self.tabBarController;
[self.window addSubview:self.tabBarController.view];
IntroViewController *introViewController = [[IntroViewController alloc] initWithNibName:@"IntroViewController" bundle:nil];
//Lets place introViewController in navController
UINavigationController * navController = [[UINavigationController alloc] initWithRootViewController:introViewController];
//Now lets display it
[self.tabBarController presentModalViewController:navController animated:YES];
[navController release];
[introViewController release];
[self.window makeKeyAndVisible];
return YES;
}