Does anybody know how to disable the 'slide-to-delete' in a uitableview?
I still want to be able to delete the rows while the table is in editing mode.
Thanks
Does anybody know how to disable the 'slide-to-delete' in a uitableview?
I still want to be able to delete the rows while the table is in editing mode.
Thanks
First, to confirm if a table cell can be deleted simply reply to canEditRowAtIndexPath.
-(void)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return YES or NO
return(YES);
}
}
Then, to actually delete the table cell reply to commitEditingStyle.
-(void)tableView:(UITableView *)tv commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete your data
// Delete the table cell
[self.tableView deleteRowAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}
Good luck Mats Stijlaart!