0

Let's say I have the following view controllers:

A -> B -> ... Z

Now let's say I'm at view controller B. If I click its back button, I'll return to view controller A. My question is: How can I make B's back button go to another view controller, say view controller Z, instead of A?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • Are you familiar with the term unwind? – Eddwin Paz Sep 25 '19 at 17:50
  • You need to return to your root view controller and from there segue to the controller you want to present. – Eddwin Paz Sep 25 '19 at 17:51
  • https://stackoverflow.com/questions/51950343/go-back-to-root-when-nav-back-button-is-press do that first and after segue to your viewcontroller. – Eddwin Paz Sep 25 '19 at 17:57
  • 1
    Consider not using a back button, but instead setting `navigationItem.leftBarButtonItem` to a `UIBarButtonItem` that will push Z, or set `navigationController.viewControllers`. Using the Back button for adding view controllers would probably be confusing to users. – Yonat Sep 25 '19 at 17:57

0 Answers0