Coocoo4Cocoa
Coocoo4Cocoa

Reputation: 50816

iPhone: Putting only one section of UITableView in Edit mode

I have three sections in my hypothetical UITableView. I'd like one section that is in editing mode. The rest of the sections to not be in editing mode. Is this possible at all?

Upvotes: 9

Views: 4498

Answers (2)

DeeNove750
DeeNove750

Reputation: 63

This worked great for me. In the example below section 0 is not editable whilst the other sections are.

override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
    if indexPath.section == 0{
        return false
    }
    return true
}

Upvotes: 0

August
August

Reputation: 12187

This really shouldn't be a mystery, as it's spelled out clearly in the documentation. Simply use the datasource method

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath

Upvotes: 25

Related Questions