How To Make A Separate Login ViewController

Discussion in 'iOS Programming' started by loon3y, Feb 23, 2012.

  1. loon3y macrumors 65816


    Oct 21, 2011
    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.
  2. xStep macrumors 68000

    Jan 28, 2003
    Less lost in L.A.
    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.window makeKeyAndVisible];
    	[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];
    	[loginVC release];
  3. jnoxx macrumors 65816


    Dec 29, 2010
    Aartselaar // Antwerp // Belgium
    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).
  4. dejo Moderator


    Staff Member

    Sep 2, 2004
    The Centennial State
    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.

Share This Page