Use a different starting view on second launch of app

196 views Asked by At

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.

2

There are 2 answers

2
Jhaliya - Praveen Sharma On BEST ANSWER

Use NSUserDefault .

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

You can use NSUserDefaults to keep track of whether the app has been launched before. I suggest you do this in - (void)applicationDidBecomeActive:(UIApplication *)application of your app delegate.