3

再会,

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

如何将控制器从登录更改为 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;
}

登录控制器.m

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

1 回答 1

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

[self.view removeFromSuperview];

appDelegate 是应用程序共享委托。

MyAppDelegate *delegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
于 2011-07-13T08:06:21.500 回答