arooo arooo -3 years ago 114
iOS Question

Highlight UITableView Without Selection

I have a custom

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

How can I highlight a
UITableViewCell
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
}

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