how 开发者_如何学编程do I remove the highlight color after a UITableCell has been selected? I am presenting a modal view over my uitableview and once that is closed the selection highlight is still there. I remember there is a simple setting somewhere but I cannot remember it.
The simplest way to deselect a cell is the -deselectRowAtIndexPath:animated: method.
To use it put this code in your Table View Delegate Method (tableView:didSelectRowAtIndexPath:):
[tableView deselectRowAtIndexPath:indexPath animated:YES];
You can change YES BOOL to NO if you don't want to deselect your cell with an animation.
The easiest solution would be to use the deselectRowAtIndexPath:animated:
method on the UITableView.
See the UITableView class reference ("Managing Selections" section) for the the full method signature, etc.
Deselect cell using -deselectRowAtIndexPath:animated:
method in selection handler
Also, if you don't know/care which cell is highlighted, and just want to deselect everything, you can use
[tableView selectRowAtIndexPath:nil animated:YES scrollPosition:UITableViewScrollPositionNone];
精彩评论