how to popToViewController with ARC and Storyboard

1.3k views Asked by At

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 ?

2

There are 2 answers

0
Alexander On BEST ANSWER

One way is to iterate through the viewControllers array of the navigation controller. You can identify the correct one by tag, class name, etc.

0
geminiCoder On

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.