How to show login screen only for the first time when app launches

Posted by Jaw Ali on Stack Overflow See other posts from Stack Overflow or by Jaw Ali
Published on 2013-07-03T09:10:53Z Indexed on 2013/07/03 11:05 UTC
Read the original article Hit count: 230

Filed under:
|
|

I want to launch the login screen when first time app launches other wise app work simple but problem is that again again it goes to login screen.

here is the code which i am using in didFininsh

I want the user show go to login screen first time only and next time it should show splitViewController

     [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES],@"firstLaunch",nil]];

if ([[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"]) {



    [self.window addSubview:[splitViewController view]];

    LoginViewController *targetController = [[LoginViewController alloc] initWithNibName:@"LoginViewController" bundle:nil];
    targetController.modalPresentationStyle = UIModalPresentationFullScreen;


    [self.splitViewController presentViewController:targetController animated:YES completion:nil];

    }

else {


    [self.window addSubview:[splitViewController view]];

}


// my comment[window addSubview:splitViewController.view];
[window makeKeyAndVisible];


return YES;

© Stack Overflow or respective owner

Related posts about ios

Related posts about iPad