Reputation: 11914
Is there a way to allow the user to select a tableViewCell, and have it look just like the settings on the iPhone does? In the settings app, when you select a row, it turns to blue when you touch down, then when you touch up the check mark moves from the row it was on to the new row, while the blue fades away.
In my app, I've implemented the same basic thing, except I don't know how to fade the blue away like that. I've tried reloading the tableSection with a fade animation, but that removes the blue much more quickly than the settings does. Also, it causes the other table cells to flash briefly.
I've also tried just specifically setting the checkmark to the new cell, but that leaves it in the old cell, and doesn't remove the highlighting.
- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[[self.fetchedResults objectAtIndexPath:indexPath] languageCode] forKey:@"inputLanguage"];
//[tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade];
[tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark;
}
Upvotes: 0
Views: 791
Reputation: 10182
To deselect the UITableViewCell do this:
[tableView deselectRowAtIndexPath:indexPath animated:YES];
Upvotes: 1