There are few similar kind of questions asked and answered by many on Stackoverflow. But none of solution matches with my requirement.
I am using Swift3 for IOS mobile app development and used Navigation controller to manage the navigation. I gave title to all pages using below code.
self.title = "Title"
When I move to next page, then it shows me back button with the earlier page title. For some pages, title is long and it disturbs my header section of page.
Instead of page title, I want to change button text to "Back". Any idea how to do that?
if you are using storyboard then you can set back button title there, click on ViewController -> Navigation Item -> Back Button and set "Back" title.
alternatively you can set title in ViewWillApear
and change it to "Back" in viewWillDisappear
method
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.title = "My Title"
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
self.title = "Back"
}