iOS 自定义UITableViewCell的高亮背景色

-(void)drawRect:(CGRect)rect
{
    if (self.highlighted) {
        self.contentView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    }else{
        self.contentView.backgroundColor = [UIColor whiteColor];
    }
}
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
    [super setHighlighted:highlighted animated:animated];
    [self setNeedsDisplay];
}

推荐阅读更多精彩内容