popping to root view in navigation controller

2020-02-09 04:39发布

问题:

I have one navigation controller with three views. I push the three view controllers onto the navigation controller's stack and want to pop all the pushed view controllers at once by the click on a button. I would like to be able to do that from any pushed view controller...

Please can you help me and give me pointers on how I could do that?

回答1:

[self.navigationController popToRootViewControllerAnimated:YES];