gpt4 book ai didi

objective-c - didSelectRowAtIndexPath : how to get old indexPath to deselect checkmark?

转载 作者:行者123 更新时间:2023-11-29 11:21:42 25 4
gpt4 key购买 nike

如何在 tableView 中取消选择先前选择的行??我找不到获取 oldIndexPath 的解决方案

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath];
if (newCell.accessoryType == UITableViewCellAccessoryNone) {
newCell.accessoryType = UITableViewCellAccessoryCheckmark;
}
}

最佳答案

除非您存储以前的索引路径,否则您将无法检索它。
只需将它存储在一个 ivar 中,当您检测到一行被选中时,下次您将能够删除前一个单元格上的复选标记。

关于objective-c - didSelectRowAtIndexPath : how to get old indexPath to deselect checkmark?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6794232/

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