You need to subclass UITableViewCell and override the following two methods:
Objective-C:
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
UIColor *backgroundColor = self.myLabel.backgroundColor;
[super setHighlighted:highlighted animated:animated];
self.myLabel.backgroundColor = backgroundColor;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
UIColor *backgroundColor = self.myLabel.backgroundColor;
[super setSelected:selected animated:animated];
self.myLabel.backgroundColor = backgroundColor;
}
Swift
override func setSelected(_ selected: Bool, animated: Bool) {
let color = myLabel.backgroundColor
super.setSelected(selected, animated: animated)
myLabel.backgroundColor = color
}
override func setHighlighted(_ highlighted: Bool, animated: Bool) {
let color = myLabel.backgroundColor
super.setHighlighted(highlighted, animated: animated)
myLabel.backgroundColor = color
}