Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/25.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
Objective c didSelectRowAtIndexPath:如何让旧的indexPath取消选中复选标记?_Objective C_Ios_Uitableview_Nsindexpath - Fatal编程技术网

Objective c didSelectRowAtIndexPath:如何让旧的indexPath取消选中复选标记?

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 ==

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

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

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