how to popToViewController with ARC and Storyboard
-
09-06-2021 - |
Question
anybody know how to popToViewController ?
example: introvideo-> welcomeview & tutorialview-> mainviewcontroller-> scannerviewcontoller-> questionview ->(if answer correct -> correctView) else ->wrongView
how do i pop back to mainView controller ?
Solution
One way is to iterate through the viewControllers
array of the navigation controller. You can identify the correct one by tag, class name, etc.
OTHER TIPS
based on what you have written It looks like MainViewController is the 4th ViewController on the navigation stack.
[self.navigationController popToViewController:[arrayOfViewControllers objectAtIndex:3] animated:YES];
should do the trick.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow