如何从CustomViewController中更改RootViewController(在AppDelegate中)?

LIA*_*IAL 3 delegates objective-c uitabbarcontroller rootview

美好的一天,

我的应用程序具有在AppDelegate中加载的授权表单(SigninController),并且在登录后(检查在SigninController.m中)TabBarController应该出现(作为应用程序的主视图).

如何将控制器从Signin更改为TabBar?

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  {  
SigninController *aSigninController = [[SigninController alloc] initWithNibName:@"SigninView" bundle:nil];
self.currentController = aSigninController;
[aSigninController release];

self.window.rootViewController = self.currentController;
[self.window makeKeyAndVisible];
return YES;
}
Run Code Online (Sandbox Code Playgroud)

SigninController.m

- (IBAction)signinClick
{
........
if (loginOK == YES)
{        
      //This place is ready to send messages to show TabBar
} else {
    UIAlertView *alert = ......
    [alert show];
    [alert release];
}    
}
Run Code Online (Sandbox Code Playgroud)

mak*_*ney 8

[appDelegate.window addSubview:appDelegate.tabbarController.view];

[self.view removeFromSuperview];
Run Code Online (Sandbox Code Playgroud)

appDelegate是应用程序共享委托.

MyAppDelegate *delegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
Run Code Online (Sandbox Code Playgroud)