Here is how to change < Back button text of your Apple iOS App

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

Mandar Apte

This website contains a design articles blog by Mandar Apte. He writes and shares his iOS development, graphic, web, & animation film design experience through articles. Mandar is Mumbai based multi-disciplinary designer with expertise in UI, UX, Logo, Symbol, and Brand Identity design. He is an alumnus of Sir J. J. Institute of Applied Art, Mumbai. He currently runs his studio in the heart of the city of Mumbai.

Leave a Reply

Your email address will not be published. Required fields are marked *