pop a specific view controller

不想你离开。 提交于 2020-01-17 01:04:13

问题


I have an hierarchy of 3 view controllers in my navigation bar controller: view1->view2->view3. After the user finished with view3 I want to take him to view1. What is the best approach to do that?

thanks,

Nava


回答1:


Assuming that view3 and view2 have already been pushed onto your navigation controller, you can use -[UINavigationController popToRootViewControllerAnimated:] or -[UINavigationController popToViewController:animated:] to accomplish this.




回答2:


Simply make the action of a UIBarButtonItem on your UINavigationController (in this case, most likely your rightBarButtonItem) call

[self.myNavController pushViewController:view1 animated: YES];


来源:https://stackoverflow.com/questions/2082539/pop-a-specific-view-controller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!