So I have four view controllers, A, B, C, D and they are shown in that order. Let’s say that I am at view C and I want to go to view D, so I push view controller D into the navigation controller stack, however, what I want is that when D tries to go back it goes directly to view controller B instead of C.
Is there a particular way to achieve this? The logical way is to do popViewController and then pushViewController: C. I tried this and it didn’t work out.
So the order is A->B->C->D right? And from D, when the “Back” button is tapped you want to go to B?
That means popping D and then popping C so you get back to B. That’s what
popToViewController:animated:does.UINavigationController Class Reference
Note that this is different from
popToRootViewControllerAnimated: