1
I would like to change the title of the back button of the navigation bar, change from "
I tried this way but I did not succeed
self.navigationController?.navigationItem.backBarButtonItem?.title = "Voltar"
1
I would like to change the title of the back button of the navigation bar, change from "
I tried this way but I did not succeed
self.navigationController?.navigationItem.backBarButtonItem?.title = "Voltar"
2
You will probably need to create an object UIBarButtonItem
.
Try this:
Swift:
let backButton = UIBarButtonItem(title: "< Back", style: UIBarButtonItemStyle.Plain, target: self, action: "goBack")
navigationItem.leftBarButtonItem = backButton
Objective C:
UIBarButtonItem *barBtnItem = [[UIBarButtonItem alloc]initWithTitle:@"Back" style:UIBarButtonItemStyleBordered target:self action:@selector(pop)];
self.navigationItem.backBarButtonItem = barBtnItem;
[barBtnItem release];
Another way you can try is that as the back button belongs to the previous Viewcontroller, you can try modifying it before you push.
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let backItem = UIBarButtonItem()
backItem.title = "Something Else"
navigationItem.backBarButtonItem = backItem // This will show in the next view controller being pushed
}
2
You can do by the interface by the following mode.
On the storyboard click on the screen you want, then on the view controller tab.
On the right side of the property, search back button and can type the desired text.
Or you can add by command in viewDidLoad.
self.navigationController? .navigationBar.topItem?. title = ""
0
Why do it in all Views if you can do it once?
For this just change in the project settings:
After that just check if your device/ emulator is configured in the Portuguese language.
Browser other questions tagged ios swift uinavigationcontroller
You are not signed in. Login or sign up in order to post.
If you change the previous view controller title, the button will use this title.
– dbmrq
I hate the default navbar, what I always do is create a view from above and customize my navbar, and the default navbar I leave hidden.
– Pablo Ruan