I am trying to switch accesoryType when a table cell is selected / deselected ... the behavior should be: tap -> set accessoryType to UITableViewCellAccessoryCheckmark -> tap cell again -> rollback to type UITableViewCellAccessoryNone . The implementation in my controller is this:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; [cell setAccessoryType:UITableViewCellAccessoryCheckmark]; } - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; [cell setAccessoryType:UITableViewCellAccessoryNone]; }
... anyway, when the style is configured as UITableViewCellAccessoryCheckmark , I cannot restore it to UITableViewCellAccessoryNone ! I also tried calling:
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
but doesnβt remove the check mark ... what should I do?
EDIT: implementation is ok, the problem was in a custom subclass of UITableViewCell ... sorry: P
source share