I have a UINavigationController into which I push several views. Inside viewDidLoad for one of these views I want to set the self.navigationI
The navigationController's backBarButtonItem is set on the item whose title you're trying to affect.
i.e. in Page 1's view controller, say, viewdidLoad:
self.title = @"Page 1 of 4";
self.navigationItem.backBarButtonItem =
[[[UIBarButtonItem alloc] initWithTitle:@"Page 1"
style:UIBarButtonItemStyleBordered
target:nil
action:nil] autorelease];
You would not override this in Page 2.
Documentation for UINavigationItem : backBarButtonItem makes this clear:
When this item is the back item of the navigation bar—when it is the next item below the top item—it may be represented as a back button on the navigation bar. Use this property to specify the back button. The target and action of the back bar button item you set should be nil. The default value is a bar button item displaying the navigation item’s title.