Objective c didSelectRowAtIndexPath:如何让旧的indexPath取消选中复选标记?
如何在tableView中取消选择以前选定的行??我找不到获取oldIndexPath的解决方案Objective c didSelectRowAtIndexPath:如何让旧的indexPath取消选中复选标记?,objective-c,ios,uitableview,nsindexpath,Objective C,Ios,Uitableview,Nsindexpath,如何在tableView中取消选择以前选定的行??我找不到获取oldIndexPath的解决方案 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath]; if (newCell.accessoryType ==
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath];
if (newCell.accessoryType == UITableViewCellAccessoryNone) {
newCell.accessoryType = UITableViewCellAccessoryCheckmark;
}
}
除非存储上一个索引路径,否则将无法检索它。
只需将其存储在ivar中,当您检测到一行被选中时,下次您将能够删除上一个单元格上的复选标记