The question is where you have this code. It should be in the previous controller - it is the back button.
A longer answer is here:
Trapping the UINavigationBar Back Button
http://osmorphis.blogspot.com/2009/03/trapping-uinavigationbar-back-button.htmlIf you need here is iOS Reference Library about the updating of the navigation bar:
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UINavigationController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006934-CH3-SW25