为什么我需要删除[self.window makeKeyAndVisible]?

时间:2011-12-01 09:19:12

标签: ios uinavigationcontroller

如果我将删除[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;
}

0 个答案:

没有答案