允许在uitableview中进行编辑,但不能在一行中进行编辑

jre*_*297 2 uitableview ios

我有一个包含多个部分的UITableView.当我将表设置为编辑模式时,我宁愿一个部分(仅包含1行)不显示编辑符号而不调用tableView:commitEditingStyle:forRowAtIndexPath:.
这可能吗?
约翰

Vij*_*com 8

这里我假设第1节和第0行无法编辑

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
    // Return NO if you do not want the specified item to be editable.

    if (indexPath.section == 1) {
        if (indexPath.row == 0) {
            return NO;  
        }
    }

    return YES;
}
Run Code Online (Sandbox Code Playgroud)