I have some UILabel inside a UITableViewCell with opaque background color and white text. When this cell is selected, the UILabel's bg color seems to be obscured by the blue bg color of the selected cell. The UILabel text, however, is showing fine. How do I get the background color of the UILabel to show on top of the cell selection color?
Had this same issue in an multiple selection table view. Try setting the background color for those labels in -layoutSubviews. Worked for me.
Looks like the background color of labels is changed together with the background color of a row (animated). I just subclassed the UILabel and "protected" backgroundColor changes after I set the initial color:
@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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With