UITableViewCell. How do I just highlight cell during touch down?

dugla picture dugla · May 1, 2012 · Viewed 17.9k times · Source

I have a custom tableViewCell. I want to indicate user touch down by highlighting. The cell selection style is UITableViewCellSelectionStyleBlue. In the parent controller I have set self.clearsSelectionOnViewWillAppear = YES.

I should be good to go. Nope. Selection still sticks to the cell. What I want is selection indication only for the duration of the touch down. The appearance should immediately return to the unselected appearance on touch up.

How do I do this?

Cheers,
Doug

Answer

Dancreek picture Dancreek · May 1, 2012
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

    [tableView deselectRowAtIndexPath:indexPath animated:YES];

}