简体   繁体   中英

iPhone switch screen in xcode 4.2

I am new to iPhone app. I was told not to use Xcode storyboard for the app to be compatible with iOS4.3 and under.

Right now, I have 2 pages showing using a tabcontroller, however I am trying to add a page that loads up first when the program is started (ie a Login page), after authenticated the user will land on the first page of the 2 tabs.

What would I need to do? Should I create a MainWindow.xib file?

Thanks!

James

You have (at least) two solutions. You can :

*Create the window the the didFinishLaunching function in your AppDelegate, with something like that:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:    (NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    RootViewController *controller = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
    self.navigationController = [[UINavigationController alloc] initWithRootViewController:controller];
    self.navigationController.delegate = controller;
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
    return YES;
}

*or you can create the MainWindow.xib file with the AppDelegate and the window, and tell your app use this nib when launched. To do that : In the .plist, enter MainWindow for the "Main nib file base name" characteristic.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM