If you use the standard UINavigationController push and pop mechanism, the left button (back) title will be the title of the previous NavigationController. This is ok a lot of the time, but sometimes you just want it to say “Back” or similar.

ss1

 

 

For example, in the image above the Navigation Title is quite long, so having the Title of the previous view instead of Back causes things to get a little busy.

To change the text or style you have to add a custom UIBarButtonItem to the previous or owner’s navigation item. That is the NavigationController before the current View on the stack. This is a little puzzling until you think about it a little bit. 

The code to add you own custom item is as follows:

UIBarItem *backBar = [[UIBarButtonItem alloc] initWithTitle:@”Back” style:UIBarButtonItemStyleDone target:nil action:nil];

self.navigationItem.backBarButtonItem = backBar;

[backBar release];

// following code pushes a new view on to the stack


[[self navigationController] pushViewController:self.goodFormViewController animated:YES];

The resulting code will look like this:

ss2