I've been struggling with this problem for some days. I've been trying to have a persistent RightBarButtonItem
in several views. By researching on several blogs and web searches, it turned out that I need to set my rightBarButtonItem
in the function -navigationController:willShowViewController:animated:
.
My app does not show any errors but when I try to debug or use NSLog
statements, it shows that the app does not enter this function at all. I have <UINavigationControllerDelegate>
in the interface of my RootViewController
class, but I also set my NSXMLParser
parser as a delegate to itself ([parser setDelegate:self];
) in another class. Can this be a problem that the navigationController
delegate is not recognized or something.
- (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated
{
//[self.navigationController.navigationItem setRightBarButtonItem:twoButtons animated:YES];
self.navigationItem.rightBarButtonItem = twoButtons;
NSLog(@"We are in navigationController delegate function");
}