Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cocoa touch 我可以在某些单元格上禁用swip以删除吗?_Cocoa Touch_Uitableview - Fatal编程技术网

Cocoa touch 我可以在某些单元格上禁用swip以删除吗?

Cocoa touch 我可以在某些单元格上禁用swip以删除吗?,cocoa-touch,uitableview,Cocoa Touch,Uitableview,我希望这样,当用户在单元格上滑动时,删除按钮不会仅显示在第一个单元格中,并启用其他单元格 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row == 0) { return NO; } else { return YES; } } 在实现tableview委托和数据源

我希望这样,当用户在单元格上滑动时,删除按钮不会仅显示在第一个单元格中,并启用其他单元格

- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        return NO;
    }
    else {
        return YES;
    }
}

在实现tableview委托和数据源的地方实现这一点。

发布相关代码,否则没有人能提供帮助。我有table view,我创建-(void)tableview:(UITableView*)tableview CommittedItingStyle:(UITableViewCellEditingStyle)editingStyle for RowAtIndexPath:(NSIndexPath*)我需要在第一个单元格中禁用滑动以不显示删除按钮用相关代码更新您的问题。不要在注释中发布代码。简单地显示一个方法的声明与相关代码相去甚远。@AhmedT3lab嗨,Ahmed,看起来你是新来的。。。通常在发布问题时需要添加一些代码。根据我对你问题的理解,我已将我的答案张贴在网上。如果对你有帮助的话,别忘了投赞成票1.这可能不是正确的答案。第1个单元格可能仍然需要可编辑,只是不可删除。@rmaddy他没有提到他也想编辑该行。。所以对他来说,这会起作用的。是的,它可能会起作用。我的观点是,有一种更具体的方法来防止删除行。如果OP没有提供更多信息,更具体的方法可能是,也可能不是更好的答案。当然,我指的是
tableView:editingstyleforrowatinexpath:
方法。