我通过实现以下方法制作了一个自定义导航栏,对于所有视图都相同 - :
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
// viewController.navigationItem.rightBarButtonItem = cancelButton;
// -- Adding INFO button to Navigation bar --
UIBarButtonItem *infoButton = [[UIBarButtonItem alloc]
initWithTitle:@"i"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(showInfo)];
infoButton.tag = 10;
self.navCntrl.topViewController.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:infoButton, nil];
self.navCntrl.navigationBar.tintColor = [UIColor colorWithRed:45/255.0 green:77/255.0 blue:67/255.0 alpha:1];
// NSLog(@"Inside implemented method");
}
的UINavigationControllerDelegate
。
在上面的方法中,我在导航项中添加了一个右键。现在我想在特定视图中隐藏这个右键。我怎样才能做到这一点?谢谢。