How To Make A Separate Login ViewController

Discussion in 'iPhone/iPad Programming' started by loon3y, Feb 23, 2012.

  1. macrumors 6502a

    Joined:
    Oct 21, 2011
    #1
    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. macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #2
    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".

    Code:
    - (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. macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #3
    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. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    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