I have a UITableview in a popover. I cannot seem to get the deselection to animate or work at all. The checkmark stays there on the previous selected row (the checkmark is set from my Model class which is just an NSDictionary, where one value is @”YES”, and all other values are @”NO.” When I close the popover, and reopen it, the checkmark is correct, but I cannot seem to get it while the popover is open. Thoughts? Thanks.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = [indexPath row];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryCheckmark;
// [cell setSelected:YES animated:YES];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
deselectRowAtIndexPathdoes not remove the accessoryView of the UITableViewCell, it removes the highlighted (blue) background of the UITableViewCell. The following code sets the check mark of a cell:cell.accessoryType = UITableViewCellAccessoryCheckmark;To remove the checkmark from that cell, you have to do:
cell.accessoryType = UITableViewCellAccessoryNone;