iPhone toggleEdit - disable delete?
When I execute toggleEdit, a red button with a white line in the middle shows up on the left (to enable delete) and a blue button with a white arrow shows up on the right of each cell in my UITable:
-(IBAction)toggleEdit:(id)sender {
[self.table setEditing:!self.table.editing animated:YES];
}
The blue button on the right shows up because for each cell I have:
cell.editingAccessoryType = UITableViewCellAccessoryDetailDis开发者_JS百科closureButton;
Is it possible when executing toggleEdit to not show the red button on the left?
Yes. In your:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
}
just return anything other than UITableViewCellEditingStyleDelete for items that are can't be deleted.
精彩评论