Display multiple levels in UITableViewController
I would like to be able to call multiple views from the UITableViewController stack. For example, in the Apple DrillDownSave example, when you view level 3 to go back to level 1, or when you view an item, to go back to level 2 when the button is pressed.
I tried:
[self.navigationController.parentViewController.navigationController popViewControllerAnimated: NO];
[self.navigationController popViewControllerAnimated: NO];
and
[self.navigationController popViewControllerAnimated: NO];
[self.navigationController.parentViewController.navigationController popViewControllerAnimated: NO];
but they leave me in the same place as one popViewControllerAnimated :. Is there an easy way to do this?
+2
source to share
2 answers
Thank you Giao for doing this. I changed my code to:
NSArray *allViewControllers = self.navigationController.viewControllers;
NSInteger n = [allViewControllers count];
[self.navigationController popToViewController: [allViewControllers objectAtIndex: (n-3)] animated: YES];
and it works great.
+7
source to share