When you open a subview in a navigation controller, the back button title is the same as the title of the previous view. This is great most of the time, but when the subview title is similar (or even identical) to the previous view then the back button title becomes redundant.

So let’s change it.

I encountered this very situation in an iPhone app I worked on recently. My solution was to ditch the default button and use a custom back button instead.

Here’s how I did it. For this example, the root view is a UITableViewController, and the code below is in the root view controller’s implementation.

– (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:
    (NSIndexPath *)indexPath
    if (! self.subViewController)
        self.subViewController = [[SubViewController alloc]
            ([SubViewController class]) bundle:nil];

    UIBarButtonItem *backButton = [[UIBarButtonItem alloc]
        initWithTitle:@"Back" style:UIBarButtonItemStyleBordered
        target:nil action:nil];

    [self.navigationItem setBackBarButtonItem:backButton];
    [backButton release];

    // Pass the selected object to the new view controller.
    [self.navigationController pushViewController:
        self.subViewController animated:YES];

This example re-uses a single view controller for all subviews, and creates the custom back button when a table row is selected.

Keep in mind this needs to be implemented where the subview is pushed onto the display stack. It won’t work if you try to do it from the subview.