如果我将删除[self.window makeKeyAndVisible],我的代码就可以了。但我不明白为什么我需要删除makeKeyAndVisible?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window.rootViewController = self.tabBarController;
if (isLoginScreenNeeded)
{
LoginModalViewController *controller = [[[LoginModalViewController alloc] initWithNibName:@"LoginModal" bundle:[NSBundle mainBundle]] autorelease];
UINavigationController *controllerNav = [[[UINavigationController alloc] initWithRootViewController:controller] autorelease];
[self.window.rootViewController presentModalViewController:controllerNav animated:NO];
//[self.window makeKeyAndVisible]; //controllerNav didn't appeared if I uncomment this string
}
else
{
[self.window makeKeyAndVisible];
}
return YES;
}