How to show login screen only for the first time when app launches
- by Jaw Ali
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;