So, I have the below UINavigationBar :
[ (<- Back) Info (Cancel) ]
Now, what I need to do is change the Titles for all the Buttons / Title to One
, Two
and Three
. I tried doing :
self.navigationController.navigationBar.topItem.title = @"One";
But this only updated the button on the left. How do I change all three?
self.navigationItem.title
will change the center title, and setting a button with title to self.navigationItem.rightBarButtonItem
will change the right button title.
And here's how I've changed the back button title. Note: this code must be used on the previous view controller (the one you'd be hitting the back button to return to), not the presently viewed controller:
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil];
}