0

I have a navigationItem on a ViewController and I want it to have it's own title and back button, but the documentation says that the only way to set the backButton's title is to change the title of the previous view's navigationItem. Is there any way to get around this?

Thanks.

Luke B
  • 288
  • 2
  • 5
  • 18
  • The back button text can be set by the previous view controller (I know, it's counter intuitive) - [for example](https://stackoverflow.com/questions/28471164/how-to-set-back-button-text-in-swift) - If it's not doing what you want, they way you want it to - I replace the back button with my own, it's more complicated, as you need to provide your own icon – MadProgrammer Apr 18 '20 at 23:19
  • Thanks a million, that is very counter intuitive but it works :) – Luke B Apr 19 '20 at 14:53

1 Answers1

0

Thanks to MadProgrammer for helping me, it's very counter-intuitive but I fixed it by doing this:

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    navigationItem.title = "Sign Out"
}

Here's the link the the SO post.

Luke B
  • 288
  • 2
  • 5
  • 18