Reputation: 719
From my Main storyboard I have 4 viewControllers, from vc3 I push to another storyboard, lets call it Second.
In the Second storyboard I go through a couple viewControllers and press save. When I press save I go back to Main viewcontroller, vc3. But the backbutton in vc3 will take me back to the Seconds storyboard where I came from. I would of course want it to go back to vc2 in Main storyboard.
I know it's a minds twister this one, but I hope anyone can help me.
I understand that much that I need to dismiss or pop the viewcontrollers from the Second storyboard when i hit Save, but I don't know how.
Any ideas?
Upvotes: 0
Views: 769
Reputation: 63
You can use
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];
with
[self.navigationController.viewControllers objectAtIndex:1]
you get the view controller that you need, i think you have to do some test to get the correct index (0 is the root view controller).
Upvotes: 1