arooo arooo -3 years ago 114
iOS Question

Highlight UITableView Without Selection

I have a custom

subclass and I'd like to show highlight state but no selection state.

How can I highlight a
background on touch (and unhighlight on release), but not show the selection state cell background (I have my own custom selection state)?

Answer Source
@implementation CustomTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // You have your code here as you said

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
    //Implement custom hilighting code

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download