I have a UINavigationController
with a UITableViewController
which has and two UIBarButtonItem
s:
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.leftBarButtonItem = self.editButtonItem;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(showSubscribeSheet:)];
self.navigationController.navigationBar.tintColor = [UIColor brownColor];
}
I want to hide self.navigationItem.rightBarButtonItem
when the UITableView
is in edit mode. What way can I do this? Thanks.
I do not use 开发者_如何转开发nibs.
Just set it to nil to hide it
self.navigationItem.rightBarButtonItem = nil ;
In your selector of the UIBarButtonItem just check the [self.tableView isEditing] where this will indicate that the table view is in the editing mode if it returns true. Else it should return false.
Override the setEditing method:
-(void)setEditing:(BOOL)editing animated:(BOOL)animated
{
[super setEditing...]
//custom code here
}
精彩评论