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

时间:2011-06-30 12:42:20

标签: ios uitableview

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

1 个答案:

答案 0 :(得分: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;
}