gpt4 book ai didi

ios - UITableView 的 allowsMultipleSelectionDuringEditing - 不显示某些单元格的编辑圈

转载 作者:可可西里 更新时间:2023-11-01 04:44:34 26 4
gpt4 key购买 nike

我试图通过将 allowsMultipleSelectionDuringEditing 设置为 YES 来删除我的 UITableView 中的一些行。这一切都很好;圆圈显示在左侧。

但是,对于某些单元格,我不希望左侧的圆圈出现。我怎么做?我在编辑过程中尝试了 cell.selectionStyle = UITableViewCellSelectionStyleNone 但没有用。

有什么提示吗?

最佳答案

为了禁止多项选择中的某些行,您应该使用 tableView:shouldIndentWhileEditingRowAtIndexPath:cell.selectionStyle = UITableViewCellSelectionStyleNone

这是我的代码中的一个示例:

- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath*)indexPath {
if (indexPath.row < 4) {
return YES;
} else {
return NO;
}
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// (...) configure cell

if (indexPath.row < 4) {
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
} else {
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
}

关于ios - UITableView 的 allowsMultipleSelectionDuringEditing - 不显示某些单元格的编辑圈,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11386287/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com