Reputation: 811
I have a tableview with a couple of cells witch can be edited. I want to remove the edit button in the toolbar if there are no cells in the table
Upvotes: 1
Views: 1597
Reputation: 910
Set rightBarButtonItem'
to nil:
self.navigationItem.rightBarButtonItem = nil;
When you want to show the edit button again, set it to self.editButtonItem
:
self.navigationItem.rightBarButtonItem = self.editButtonItem;
Upvotes: 4
Reputation: 1412
You should implement this method
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
in tableview delegate. There you can return appropriate editing style for your cells: UITableViewCellEditingStyleDelete for deletable cells, UITableViewCellEditingStyleNone for others
so if u don't have any row, put you table view style UITableViewCellEditingStyleNone
Upvotes: -2