特定行的UITableViewCell编辑样式

Aks*_*hay 4 iphone objective-c uitableview ios

我一直试图删除特定的行UITableView,使用下面的委托方法

tableView commitEditingStyle:editingStyle forRowAtIndexPath:
Run Code Online (Sandbox Code Playgroud)

我的意图是不要仅为特定单元格显示"删除"按钮.请任何人都可以帮我解决这个问题.

iPa*_*tel 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;
}
Run Code Online (Sandbox Code Playgroud)

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