Hi,
I have a UITableView that I want to use to allow multiple selections. I have rolled together most of the functionality, but am having one small problem.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"Selected");
UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];
if ([selectedCell accessoryType] == UITableViewCellAccessoryNone) {
[selectedCell setBackgroundColor:[UIColor grayColor]];
[selectedCell setAccessoryType:UITableViewCellAccessoryCheckmark];
[[selectedCell textLabel] setTextColor:[UIColor whiteColor]];
} else {
[selectedCell setAccessoryType:UITableViewCellAccessoryNone];
[selectedCell setBackgroundColor:[UIColor clearColor]];
[[selectedCell textLabel] setTextColor:[UIColor blackColor]];
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
This is the code I am using to keep the cell selected, however when the user taps on the cell, the aaccessory view turns white and then turns back to blue.
What is the best way for me to keep the accessory view white?
Thanks