美文网首页
解决Cell点击选中时内部Label背景颜色消失

解决Cell点击选中时内部Label背景颜色消失

作者: ___1o_8o | 来源:发表于2016-07-14 12:56 被阅读108次

    在自定义cell的时候,在这两个方法里面都设置上UILabel的背景颜色为需要颜色即可

    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Menlo}p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Menlo; color: #539aa4}p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 16.0px Menlo; min-height: 19.0px}span.s1 {font-variant-ligatures: no-common-ligatures}span.s2 {font-variant-ligatures: no-common-ligatures; color: #c32275}span.s3 {font-variant-ligatures: no-common-ligatures; color: #3d1d81}span.s4 {font-variant-ligatures: no-common-ligatures; color: #000000}span.s5 {font-variant-ligatures: no-common-ligatures; color: #c91b13}span.s6 {font-variant-ligatures: no-common-ligatures; color: #539aa4}span.s7 {font-variant-ligatures: no-common-ligatures; color: #703daa}span.s8 {font-variant-ligatures: no-common-ligatures; color: #78492a}span.s9 {font-variant-ligatures: no-common-ligatures; color: #0435ff}
    
    - (void)setSelected:(BOOL)selected animated:(BOOL)animated{
        [super setSelected:selected animated:animated];
        if ([self.alertModel.alert_type isEqualToString:@"0"]) {
            self.typeLb.backgroundColor = RGBColor(0xff6600);
        }else if ([self.alertModel.alert_type isEqualToString:@"1"]){
            self.typeLb.backgroundColor = RGBColor(0x009900);
        }else if ([self.alertModel.alert_type isEqualToString:@"2"]){
            self.typeLb.backgroundColor = RGBColor(0x1583df);
        }
    }
    
    - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{
        [super setHighlighted:highlighted animated:animated];
        if ([self.alertModel.alert_type isEqualToString:@"0"]) {
            self.typeLb.backgroundColor = RGBColor(0xff6600);
        }else if ([self.alertModel.alert_type isEqualToString:@"1"]){
            self.typeLb.backgroundColor = RGBColor(0x009900);
        }else if ([self.alertModel.alert_type isEqualToString:@"2"]){
            self.typeLb.backgroundColor = RGBColor(0x1583df);
        }
    }
    

    相关文章

      网友评论

          本文标题:解决Cell点击选中时内部Label背景颜色消失

          本文链接:https://www.haomeiwen.com/subject/njmejttx.html