Reputation: 35
I'm in the early stages of creating an application and have run into a problem. Essentially, I'm using the Parse SDK to signup/login to the backend. The loginViewController is the initial view controller. Upon tapping 'signup', the signupViewController is presented modally. Once the user is logged in, I want the tab bar controller that contains the rest of the app to be presented modally.
Here's the storyboard so far:
Now when the user logs in, I perform the manual segue between login and signup. That works perfectly. My question is, what would be the best practice for doing the same thing for the signup view controller? Should I create ANOTHER manual segue between it and the tab bar controller, or is there someway I can dismiss it first, and then perform the segue from the login view controller.
I have looked for an answer in Apple's documentation, and on a few other sites, without any success. Any help at all on the matter would be appreciated greatly!
Upvotes: 2
Views: 1190
Reputation: 171
You could have the loginViewController be "aware" of the state of things and handle the routing. For example:
Another option would be to combine the login and sign viewcontrollers into one and show/hide the controls on the form depending on the mode, which will then simplify your flow having just one vc to deal with.
Upvotes: 1
Reputation: 10517
There is an option I can suggest. You can instantiate view controller using the approach
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
id controllerToPush = [storyboard instantiateViewControllerWithIdentifier:@"desiredViewController"];
(MainStoryboard_iPhone and desiredViewController are specified in interface builder). Then push this controller. For instance, if you're using Navigation controller pattern:
[self.navigationController setViewControllers:@[controllerToPush] animated:YES];
Upvotes: 0