今天遇到一个问题就是在做tableView 的批量筛选的时候 点击cell跳转时发现 cell中的label的背景颜色突然消失。
尝试设置了
cell.selectedBackgroundView = [[UIView alloc]initWithFrame:CGRectZero];
及
// cell.multipleSelectionBackgroundView = [[UIView alloc] initWithFrame:cell.bounds];
// cell.multipleSelectionBackggroundView.backgroundColor = [UIColor clearColor];
都没解决
后来重写了选中时的方法,出现的效果是:选中时lable的背景颜色还闪烁一下然后恢复。
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
[_putLable setBackgroundColor:LHQColorWithAlpha(252, 108, 72, 1)];
}
最终的解决办法时 同时重写选中和高亮方法
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
[super setSelected:selected animated:animated];
[_putLable setBackgroundColor:LHQColorWithAlpha(252, 108, 72, 1)];
}
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
[_putLable setBackgroundColor:LHQColorWithAlpha(252, 108, 72, 1)];
}