elise
elise

Reputation: 3

Choose storyboard at launch

I have created three different storyboards for an app (a,b,c). The first (a) is a welcome screen, where you choose which storyboard (b or c) you want. I can't figure out how to do this. I would like it to save your preference so you only have to choose once. Any help would be appreciated!

Upvotes: 0

Views: 99

Answers (2)

leonkuehn
leonkuehn

Reputation: 124

You can do that in: target -> general -> Deployment Info -> Main Interface
There you can set your Storyboard (e.g. a)
Then, if you want to switch to the next choose storyboard you create e.g. two buttons and call the method:

//For open Storyboard B
UIStoryboard *storybordB = [UIStoryboard storyboardWithName:@"b" bundle:nil];
UIViewController *viewControllerB = [storybordB instantiateViewControllerWithIdentifier:@"myViewController"];
viewControllerB.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController: viewControllerB animated:YES completion:NULL];

//For open Storyboard C
UIStoryboard *storybordC = [UIStoryboard storyboardWithName:@"c" bundle:nil];
UIViewController *viewControllerC = [storybordC instantiateViewControllerWithIdentifier:@"myViewController"];
viewControllerC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController: viewControllerC animated:YES completion:NULL];

Upvotes: 1

lee
lee

Reputation: 8115

I recommend you use Tab bar Controller to do it. And to make a as a main(first) viewcontroller you can set as bellow:

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



    A *a = // determine the initial view controller here and instantiate it with [storyboard instantiateViewControllerWithIdentifier:];

    self.window.rootViewController = a;//making a view to root view
    [self.window makeKeyAndVisible];

    return YES;
}

Upvotes: 1

Related Questions