开发者

How to change RootViewController (in AppDelegate) from within CustomViewController?

开发者 https://www.devze.com 2023-03-20 03:20 出处:网络
Good day, My app has authorization form (SigninController) which is loaded in AppDelegate, and after signing in (checking is in SigninController.m) TabBarController should appear (as main view of app

Good day,

My app has authorization form (SigninController) which is loaded in AppDelegate, and after signing in (checking is in SigninController.m) TabBarController should appear (as main view of application).

How can I change controller from Signin to TabBar and where ??

- (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;
}

SigninController.m

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


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

[self.view removeFromSuperview];

appDelegate is the application shared delegate.

MyAppDelegate *delegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号