选择UITableViewCell时,UILabel背景模糊

pix*_*eak 9 iphone objective-c ios

我在UITableViewCell中有一些UILabel,背景颜色和白色文本不透明.选择此单元格时,UILabel的bg颜色似乎被所选单元格的蓝色bg颜色遮挡.然而,UILabel文本显示正常.如何让UILabel的背景颜色显示在单元格选择颜色之上?

在此输入图像描述

小智 16

在多选表格视图中有同样的问题.尝试在-layoutSubviews中设置这些标签的背景颜色.为我工作.


小智 5

看起来标签的背景颜色与行的背景颜色(动画)一起更改.在设置初始颜色后,我只是将UILabel和"protected"backgroundColor更改为子类:

@interface MyLabel : UILabel {
    BOOL isColorLocked;
}
@property (assign, nonatomic) BOOL isColorLocked;
@end

@implementation MyLabel
@synthesize isColorLocked;
- (void)setBackgroundColor:(UIColor *)backgroundColor {
    if (!isColorLocked) {
        super.backgroundColor = backgroundColor;
    }
}
@end
Run Code Online (Sandbox Code Playgroud)