how to pop when first pushed vc then presented modal vc 12 times?

前端 未结 6 836
被撕碎了的回忆
被撕碎了的回忆 2021-01-29 10:33

I have a navigation controller. I first pushed a VC, then presented 12 modals VC\'s. Now I want to pop to root viewController. How can I do that? Please help me out.

6条回答
  •  孤城傲影
    2021-01-29 11:07

    If you have navigation controller and want to enjoy the benefits of popping back multiple levels in a single command, then you should be using pushViewController (or push segues) not presentViewController (or modal segues).

    As others have pointed out, if you were correcting pushing to the subsequent controllers, then you could pop back via:

    [self.navigationController popToRootViewControllerAnimated:YES];
    

提交回复
热议问题