UITableViewCell选中UILabel背景色消失
2019-01-22 本文已影响11人
CombatReadiness
解决办法
- 想要点击Cell依然有高亮效果,在Cell中写入
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
//自己的label及自己要设置的label背景色
self.messageLabel.backgroundColor = [UIColor redColor] ;
}
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
[super setHighlighted:highlighted animated:animated];
//自己的label及自己要设置的label背景色
self.messageLabel.backgroundColor = [UIColor redColor] ;
}
- 想要点击Cell没有高亮效果,只需设置cell
cell.selectionStyle = UITableViewCellSelectionStyleNone;