Using navigationTitle doesn't change in subview


#1

I did like the book said, adding [[self navigationItem] setBackButtonTitle:[item itemName]];' in setItem in DetailView but id doesn’t work, had to set title in didSelectRowAtIndexPath and is works, but have to reset to normal after leaving the view.
Can’t figure out why, driving m nuts, any idea or help appreciated.
Thanks


#2

Found out this,
dbrajkovic.wordpress.com/2012/10 … ation-bar/
So found this way, but can’t get why it is supposed to work in book !

ItemsViewController.m

[code]- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear];
[[self tableView] reloadData];
UINavigationItem *n = [self navigationItem];
[n setTitle:@“Homepwner”];

}
[/code]

and added this line in the didSelectRowAtIndex

UINavigationItem *n = [self navigationItem]; [n setTitle:[selectedItem itemName]];

Works fine, but I would like to understand :slight_smile:


#3

ok, guess coding at 3 am is not such a good idea ! Focused my mind on the button not the tittle :frowning:
But with all this did learn about UINavigation in depth, and that if you want to change the back button in the detail view you have to do it before hand in the itemsViewController since the button is linked to the view calling the subview, so if you want to customise the “Back” button do not do it in the DetailViewController it will not work !