Andy A
Andy A

Reputation: 4301

Forcing a push to a page after a pop

I have a screen where the user creates a login and presses the save button. At this point I pop back to the previous screen full of saved logins like this ...

[self.navigationController popViewControllerAnimated:YES];

However, in this scenario only (once they have pressed save), I want to automatically push the user to another screen (effectively logging them in using the login they just made). This is to ensure that if the user goes back a screen, they return to the list of logins and not to the 'create new login' screen.

My question is how can I force this push in this scenario? Can I somehow make the logins page recognise when the user has just come back from successfully making a login?

Upvotes: 0

Views: 130

Answers (1)

visakh7
visakh7

Reputation: 26400

-(void)viewWillAppear:(BOOL)animated
{

if(isLoggedIn)
{
//Do something
}
else
{
//Show login
}
}

Or if you are using a centralized navigation controller you can do this in your login view controller

- (IBAction)saveButtonPressed
{
[yourAppDelegate.mainNavigationController popViewControllerAnimated:YES];
[yourAppDelegate.mainNavigationController pushViewController:nextView animated:YES];

}

Upvotes: 1

Related Questions