kylef-archive / KFData

Core Data done right for iOS 5+/OS X 10.7+
http://cocoadocs.org/docsets/KFData/
BSD 2-Clause "Simplified" License
53 stars 7 forks source link

Allow KFDataTableViewController subclasses to disable row editing #60

Closed calvincestari closed 10 years ago

calvincestari commented 10 years ago

This enables a simple KFDataTableViewController subclass to disable row editing without needing to subclass KFDataTableViewDataSource only to override one method.

kylef commented 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.

calvincestari commented 10 years ago

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.