Reputation: 1634
How to deselect previously selected row in tableView ?? I can't find solution to obtain oldIndexPath
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *newCell = [tableView cellForRowAtIndexPath:indexPath];
if (newCell.accessoryType == UITableViewCellAccessoryNone) {
newCell.accessoryType = UITableViewCellAccessoryCheckmark;
}
}
Upvotes: 1
Views: 1493
Reputation:
Unless you store the previous index path, you won't be able to retrieve it.
Just store it in an ivar, when you detect a row is selected, the next time you will be able to remove the checkmark on the previous cell.
Upvotes: 2