grigy
grigy

Reputation: 6826

How to conditionally load different storyboards?

I'm relatively new to iOS development and I decided to rely on Parse for user signup and authentication flows of my app.

The problem is the following.

I want to load different scoreboards depending if the user logs in on signs up. For example if user signs up (or logs in first time) I want to take her through the tour. But next time user signs in she will see the main app view.

What is the best way to achieve this?

Upvotes: 1

Views: 177

Answers (1)

CRDave
CRDave

Reputation: 9285

I dont know about parse but I can guid you for storyboard.

First of all you don't need two storyboard. One is enough to achieve this.

Design your tory board something like this:

UINavigationController(1)->UIViewController(signup)->UIViewController(Tour)->UINavigationController(2)->UIViewController(signin)

Make UINavigationController(1) your root view controller so when application load first time it will show UIViewController(signup).

Now in appDelegate white something like following in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method

if(ISSignUP)
{
    window.rootViewController = [window.rootViewController.storyboard instantiateViewControllerWithIdentifier:@"UINavigationController(2)_ID"];
}

Here UINavigationController(2)_ID is identifier you give to UINavigationController(2)

Post comment if you want more guid or face any problem.

Have a nice day.

Upvotes: 1

Related Questions