I'm trying to set the BACK button for a pushed VC set within a UINavigationController stack. I use the following code, and it's not working - I still get the previous VC name appearing as the back button title.
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.title = @"VC Title";
UIBarButtonItem* myBackButton = [[UIBarButtonItem alloc]
initWithTitle:@"Back"
style:UIBarButtonItemStyleBordered
target:nil
action:nil];
self.navigationItem.backBarButtonItem = myBackButton;
}
Anyone?
in parent view controller:
- (void)viewWillDisappear:(BOOL)animated
{
self.title = @"Back";
}
- (void)viewWillAppear:(BOOL)animated
{
self.title = @"Title of your navigation bar";
}
Will do the trick