Just a small adjustment of the logic there:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath
{
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
if (self.lastSelected && (self.lastSelected.row == indexPath.row)) {
cell.accessoryType = UITableViewCellAccessoryNone;
[cell setSelected:NO animated:TRUE];
self.lastSelected = nil;
} else {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
[cell setSelected:TRUE animated:TRUE];
UITableViewCell *old = [self.tableView cellForRowAtIndexPath:self.lastSelected];
old.accessoryType = UITableViewCellAccessoryNone;
[old setSelected:NO animated:TRUE];
self.lastSelected = indexPath;
}
}