I want to hide the rightNavigationBarItem when my ViewController loads. How is it possible? I have tried this code but it is not working.
self.navigationItem.rightBarButtonItem = nil;
In Xcode 4. using these won't work;
self.navigationItem.leftBarButtonItem.enabled=NO;
self.navigationItem.leftBarButtonItem=nil;
self.navigationController.navigationBar.backItem.hidesBackButton=YES;
[self.navigationItem.leftBarButtonItem release];
I'm actually interested why you mention rightBarButtonItem? When you navigate, its the leftBarButtonItem that changes.
What Does Work;
1) self.title =@"";
nulling the title of the screen, when the navigation controller pushes a detail view onto the stack, no back button is created.
2) replacing the leftBarButtonItem
with something else changes the button, but doesn't solve your problem.
3) An alternative. Hide the navigation bar; [self.navigationController setNavigationBarHidden:YES animated:YES];