问题描述
我希望能够从UITableViewController堆栈中弹出多个视图。例如,在Apple DrillDownSave示例中,当查看级别3以返回级别1或查看项目时,按下按钮时返回级别2.
I would like to be able to pop multiple views from a UITableViewController stack. For example in the Apple DrillDownSave example, when viewing Level 3 to go back to Level 1 or when viewing an Item to go back to Level 2 when a button is pushed.
我试过了:
[self.navigationController.parentViewController.navigationController popViewControllerAnimated: NO];
[self.navigationController popViewControllerAnimated: NO];
和
[self.navigationController popViewControllerAnimated: NO];
[self.navigationController.parentViewController.navigationController popViewControllerAnimated: NO];
但这些只留下一个popViewControllerAnimated:有没有一种简单的方法可以做到这一点?
but these leave me the same place as just a single popViewControllerAnimated:. Is there an easy way to do this?
推荐答案
你想要的是发送 popToViewController:animated:
到导航控制器。您可以使用导航控制器的 viewControllers
属性来确定要弹出的视图控制器。
What you want is to send popToViewController: animated:
to the navigation controller. You can use the navigation controller's viewControllers
property to figure out which view controller it is that you want to pop to.
这篇关于在UITableViewController中弹出多个级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!