Closed calvincestari closed 10 years ago
I think it's better to do this in UITableViewDelegate as this provides more control over the editing types and allow more control with selective deletion.
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellEditingStyleNone;
}
The data source supports deletion and it should be disabled at the presentation layer.
I don't agree. Returning UITableViewCellEditingStyleNone is simply a side-effect of the implementation.
tableView:canEditRowAtIndexPath: defines whether it's possible and tableView:commitEditingStyle:forRowAtIndexPath: defines the result.
This enables a simple KFDataTableViewController subclass to disable row editing without needing to subclass KFDataTableViewDataSource only to override one method.