Search code examples
ioslaunchpresentmodalviewcontroller

Q:Controller present 2 second , how to make it looks like only one transition?


I have a requirement, Controller1 present to -> Controller2 -> present to Controller3, how to make it looks like Controller1 present to -> Controller3?

You know the requirement is when I start my app, it will first in LaunchController then LoginController, and at last it present to MainController,but when I second time to start my app, it looks like from LaunchController present to MainController, because I saved the username and password in my sandbox. How to realize the function?


Solution

  • You can set the rootviewcontroller of your application window to your MainController directly the second time; when you have username & password. Something like this:

    if(username && password)
            [self.window setRootViewController:[[MainController alloc] initWithNibName:@"MainController" bundle:nil]];
    

    You can do this inside

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions