IPhone : Ignore presentModalViewController upon return

on Saturday, March 28, 2015

So I am hoping this is simple and can be done:


I have a LoginViewController that performs a Facebook login. I have the code setup so that once the user enters his or her information and clicks login, it returns to the same LoginViewController then automatically segues to a tab controller. What I want to have happen, is for a button called "My Profile" in another view controller "ProfileViewController" much later in the Storyboard (6 views later) take me back to this initial LoginViewController.


The issue is that the segue I have that goes directly from clicking "login" to my tab controller is hard coded into the LoginViewController.m file. This makes it so when I click "My Profile" in the ProfileViewController, it takes me back to the LoginViewController, which then segues automatically to the tab controller like it does in the beginning.


What I want is to have this segue ignored when I click the "My Profile" button. Here is the segue that I am using (this is in my LoginViewController.m file):



UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UITabBarController *tabcontroller = (UITabBarController *)[storyboard instantiateViewControllerWithIdentifier:@"TabController"];
[self presentModalViewController:tabcontroller animated:YES];


I just want to have this segue ignored (AKA run only one time) while the user is logged in, so that clicking the "My Profile" button shows the LoginViewController as if the above code was not written at all (AKA a user profile view).


0 comments:

Post a Comment