I am currently trying to change the back button text of a subview that is loaded of a tablecell touch. However even with the way I am trying to implement it it still shows the parents title in the back button.
I am trying to load a new value into the back button inside viewdidload method like so
UIBarButtonItem *myBarButtonItem = [[UIBarButtonItem alloc] init];
myBarButtonItem.title = @"Back";
self.navigationItem.backBarButtonItem = myBarButtonItem;
[myBarButtonItem release];
however its not working.
You need to change self.navigationItem.backBarButtonItem
from previous view, not current view (I know, it seems to be a little bit illogical). For example, in your table view you can do the following:
- (void)viewDidLoad
{
[super viewDidLoad];
[self setTitle:@"My title"];
UIBarButtonItem *boton = [[UIBarButtonItem alloc] initWithTitle:@"Custom back button text" style:UIBarButtonItemStyleBordered target:self action:@selector(mySelector:)];
self.navigationItem.backBarButtonItem = boton;
[boton release];
}