I am trying to delete some rows in my UITableView by setting allowsMultipleSelectionDuringEditing to YES.  This is all working well; the circle is showing on the left hand side.  
However, for certain cells, I don't want the circle on the left hand side to come up.  How do I do that?  I've tried cell.selectionStyle = UITableViewCellSelectionStyleNone during editing and that didn't work.
Any hints?
In order to disallow some rows from multiple selection you should use tableView:shouldIndentWhileEditingRowAtIndexPath: mixed with cell.selectionStyle = UITableViewCellSelectionStyleNone.
Here is an example from my code:
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath*)indexPath {
    if (indexPath.row < 4) {
        return YES;
    } else {
        return NO;
    }
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    // (...) configure cell
    if (indexPath.row < 4) {
        cell.selectionStyle = UITableViewCellSelectionStyleBlue;
    } else {
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
}
First, use these settings:
self.tableView.allowsMultipleSelectionDuringEditing = true
self.tableView.setEditing(true, animated: false)
And implement next delegate methods:
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
    return self.shouldAllowSelectionAt(indexPath)
}
func tableView(_ tableView: UITableView, shouldIndentWhileEditingRowAt indexPath: IndexPath) -> Bool {
    return self.shouldAllowSelectionAt(indexPath)
}
func tableView(_ tableView: UITableView, willSelectRowAt indexPath: IndexPath) -> IndexPath? {
    if self.shouldAllowSelectionAt(indexPath) {
        return indexPath
    }
    return nil
}
shouldAllowSelectionAt is my private method which contains logic about which row to select
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With