How do I change the title of the "back" button on a Navigation Bar
This should be placed in the method that calls the ViewController titled "NewTitle".Right before the push or popViewController statement.
UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithTitle:@"NewTitle" style:UIBarButtonItemStyleBordered target:nil action:nil];[[self navigationItem] setBackBarButtonItem:newBackButton];[newBackButton release];
In ChildVC this worked for me...
self.navigationController.navigationBar.topItem.title = @"Back";
Works in Swift too!
self.navigationController!.navigationBar.topItem!.title = "Back"
Here is the documentation for backBarButtonItem:
"When this navigation item is immediately below the top item in the stack, the navigation controller derives the back button for the navigation bar from this navigation item. [...] If you want to specify a custom image or title for the back button, you can assign a custom bar button item (with your custom title or image) to this property instead."
View Controller A (the "parent" view controller):
self.title = @"Really Long Title";UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Short" style:UIBarButtonItemStyleBordered target:nil action:nil];self.navigationItem.backBarButtonItem = backButton;
When any other view controller B is on top of the navigation stack, and A is right below it, B's back button will have the title "Short".