我有一个UITableViewCell
基于 Storyboard Prototype 单元的自定义。在我的自定义单元格类中,我根据单元格状态“选定”或“突出显示”为单元格着色,代码如下所示:
- (void)updateCellDisplay {
if (self.selected || self.highlighted) {
self.label.textColor = [UIColor whiteColor];
self.backgroundColor = [UIColor myLightBlueColor];
} else {
self.label.textColor = [UIColor blackColor];
self.backgroundColor = [UIColor whiteColor];
}
}
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
[super setHighlighted:highlighted animated:animated];
[self updateCellDisplay];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
[self updateCellDisplay];
}
现在我在 iOS7 中出现了这种奇怪的行为,即在选择结束后,单元格将自身重新绘制为完全蓝色。标签不再可见。看起来该单元格具有覆盖所有内容的前景色。这适用于 iOS7 之前的所有 iOS 版本。
那会是什么?