View Full Version : How To Make A Separate Login ViewController
Feb 23, 2012, 07:52 PM
i made a login screen for my tab bar app, i want to make it so the login screen appears when u first login and than disappears after u log in, but i don't want it to be in the tab bar.
Feb 24, 2012, 02:13 AM
I've done something similar in an earlier version of applicationDidFinishLaunching: in my app delegate. I have not tried this with the newer version of application:didFinishLaunchingWithOptions: but expect it to work. When you return from the login screen, it will return to the view controller you have already setup where I comment "The usual setup".
- (void)applicationDidFinishLaunching:(UIApplication *)application
// The usual setup.
[self login: self];
- (void) login: (id) sender
LoginVC * loginVC = [[LoginVC alloc] initWithNibName:@"LoginVC" bundle: nil];
// Do any extra setup of loginVC here.
[self.navigationController setNavigationBarHidden: YES animated: YES];
[self.navigationController pushViewController: loginVC animated:YES];
//[self presentModalViewController: loginVC animated: YES];
Feb 24, 2012, 03:00 AM
Hmm, I took nearly the same approach as above post.
But we had a user saved, so checked first if there was one saved, if there isn't, show the tabbar (by adding it to the window), and otherwise showing the login view as a controller, and if your login options are met, then show the tabbar controller (could be done via NSNotification or whatever).
Feb 24, 2012, 09:29 AM
What I've done to add a startup login to an otherwise working UI, is simply to present the login view controller modally and then dismiss it once they've logged in.