我有一个UITableView
,可让用户为搜索功能选择过滤器:点按每一行以添加适用的过滤器等。当选择一行时,该应用会执行大量操作,包括在行的最右侧添加自定义图标以指示它已被选中。
在iOS 7上一切正常,但现在在iOS 8上,它强制选中每行所选行的最左边的复选标记(就像在Mail中选择多个要编辑的电子邮件一样)。
这看起来似乎只是一个简单的修复,只是一个新的属性或在iOS 8中设置的东西,但我无法找到这些方面的任何内容。我发布了一些代码,但我不知道代码中是什么导致iOS 8中发生这种情况(或者未能阻止它发生)。
任何人都可以帮我隐藏那些"编辑选中标记"在UITableView
中,或解释为什么他们在iOS 8中会有不同的行为?
更新:根据评论中的要求,以下是我的cellForRowAtIndexPath
方法。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
HierarchyLookupBase* item = [_Hierachy itemForRowAtIndexPath:indexPath];
KFTableViewCellHierarchyStyle* cell = (KFTableViewCellHierarchyStyle *)[tableView dequeueReusableCellWithIdentifier:@"Cell"];
if (cell == nil) {
cell = [[KFTableViewCellHierarchyStyle alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
[self selectedCellView:cell];
}
cell.indentationLevel = [_Hierachy levelForRowAtIndexPath:indexPath];
cell.text = item.Description;
cell.isLastChild = item.isLastChild;
cell.hasSelectedChildren = item.hasSelectedChildren;
if (item.isSelected) {
[self.tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
}
return cell;
}
selectRowAtIndexPath
方法目前尚未触及。
答案 0 :(得分:1)
tableView:didSelectRowAtIndexPath:
会触发该复选标记。你可能也必须覆盖它。
答案 1 :(得分:-1)
尝试设置self.tableView.allowsMultipleSelectionDuringEditing = NO;
此属性也可在IB
中设置。