I'm trying to toggle accesoryType when a table cell is selected/deselected... the behavior should be: tap -> set accessoryType to UITableViewCellAccessoryCheckmark -> tap the cell again -> rollback to UITableViewCellAccessoryNone type. The implementation in my controller is the following:
- (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 once the style is configured as UITableViewCellAccessoryCheckmark I'm unable to restore it back to UITableViewCellAccessoryNone! I also tried to call:
[tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationNone];
but does not remove the checkmark... what should I do?
EDIT: The implementation is ok, the problem was in the custom UITableViewCell subclass... sorry :P