While we use app development methodology like MVC (Model, View, Controller) we encounter problem while navigating from one view to another how to change text of back button which get populated automatically by Apple iOS Operating System.
You can use below method in viewDidLoad method of your root view:
navigationItem.backBarButtonItem = UIBarButtonItem(title: "Back", style: .plain, target: nil, action: nil)
Here is another way of doing the same which can be done in ‘prepare for segue’ method of your app:
// In a storyboard-based application, you will often want to do a little preparation before navigation override func prepare(for segue: UIStoryboardSegue, sender: Any?) { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. if segue.identifier == "showImage" { let backItem = UIBarButtonItem() backItem.title = "Back"; navigationItem.backBarButtonItem = backItem } }
Hope this helps,
Thanks & Regards
Mandar Apte