views:

32

answers:

2

I've been googling this for days, and I'm pulling my hair out trying to get this to work. In my app, the very first view that loads is a view that has a login and signup button. Pressing the login button calls

- (IBAction)login:(UIButton *)sender {
  LoginViewController *loginView = [[LoginViewController alloc] initWithNibName:@"LoginView" bundle:nil];
  [self presentModalViewController:loginView animated:YES];
  [loginView release];
}

Which presents a login form. After the user logs in, I would like to dismiss the modal view (which I already have implemented) and then replace the view with the login and signup buttons with an entirely new view/view controller and have that be the root controller for UINavigationController. And go on from there.

How can I implement this? Thanks!

EDIT: I ended up starting off with a tab bar-based app with a navigation controller for each tab (which solved my other problems) and dealing with the login part after I work on the main part of the app. Upon launch, I'm going to check if the user is logged in and if not, present the login view modally but with no animation.

+1  A: 

I just re-read your question and I'd missed the part about it being the root controller in your navigation controller. Perhaps you could replace the navigation controller? Or perhaps not even use a navigation controller until you actually need it?

v01d
A: 

Why not make the view after login root, but on app startup call [self.navigationItem setHidesBackButton:YES];, and then push your login view (not animated). Then present your modal view controller, and when the login is finished, dismiss the modal view controller and call [self.navigationController popToRootViewControllerAnimated:NO]; on the view with the login/signup buttons.

jrtc27