Search code examples
objective-cioscocoa-touchiphone-sdk-3.1

Use a different starting view on second launch of app


I have two apps; the first app will launch the second app and then when clicking the "Back" button, it will launch the first app again for a second time.

Assuming I have three views (view1, view2, view3), on my first launch of the apps, it will start on view1 by default, but I need it to start on view2 on my second launch of the apps. How can I do that? Can anyone at least give me some clues?

I'm using a push view for swiping from view1, view2 and view3.

This app is used on an iPhone/iPod on iOS 3.1.


Solution

  • Use NSUserDefault .

    if(![[NSUserDefaults standardUserDefaults] boolForKey:@"firstTime"]) 
    {   
        [self displayFirstView];
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"firstTime"];
    }
    else
    {
        [self displaySecondView];
    }