4

我一直在尝试UITableView使用以下委托方法删除中的特定行

tableView commitEditingStyle:editingStyle forRowAtIndexPath:

我的意图是不只为特定单元格显示“删除”按钮。请任何人都可以帮助我如何解决这个问题。

4

1 回答 1

6

使用以下 Datasource 方法UITableView

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

    if("Your Condition") // such like indexPath.row == 1,... or whatever.
        return YES;
    else
        return NO;
}

简而言之,您要编辑return YES的特定行/单元格return NO;

于 2013-09-02T11:44:27.143 回答