In my navigation stack, I have 2 viewcontrollers, which were pushed to the navigation stack. Over that I have a PresentModalViewController as rootviewcontroller and I push 2 more viewcontrollers over it. So the navigation stack will be like
ViewController
ViewController
PresentModalViewController as rootviewcontroller
ViewController
ViewController
From the topmost viewcontroller, on a button click, I would like to move to the bottommost viewcontroller. The viewcontrollers in between should be popped or dismissed. How is it possible.
I have tried dismissModalViewControllerAnimated: and popToRootViewControllerAnimated: without any success.
Used delegates to solve this problem.
}
The
ModalViewController, which is the currentRootViewControlleris dismissed in theOnHome:(id)sendermethod inMyCurrentVIewControllerclass. After dismissing theModalViewController, I popped to the current rootviewcontroller in the navigation stack, which is the home view(firstViewController). The above code works perfectly in my case.