The back button pulls its text from the title of the parent view controller.
In the parent view controller (the view controller that appears when you tap the back button), set its own title as the desired text on the back button.
For example, let's say we have a RootViewController
class. When we click a cell in its table view, we push an instance of SecondViewController
. We want the back button of the SecondViewController
instance to read, "Home."
in the viewDidLoad
method of RootViewController.m:
self.title = @"Home";
in the viewDidLoad
method of SecondViewController.m:
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
If you want your back button to read, "Back," set the title of the parent view controller to @"Back"
;