11

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 Answer 1

52
[self.navigationController popToRootViewControllerAnimated:YES];
2
  • 1
    thanks, is there a way for the rootviewcontroller to know that this action happened, so it can give a feed back like "Done bro!" ?
    – Esqarrouth
    Commented Feb 16, 2014 at 9:18
  • 1
    navigationController?.popToRootViewControllerAnimated(true) for Swift Commented Mar 4, 2016 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.