iOS UITableViewCell选中时,子视图背景颜色受影
2017-05-09 本文已影响38人
觉醒的苍红之刃
效果预览

实现
在该cell的layoutSubviews方法中再次设置对应子视图的背景颜色
实现代码
- Swift3.0代码
override func layoutSubviews() { super.layoutSubviews(); unreadLabel?.backgroundColor = UIColor.hx_color(withHexRGBAString: "#FF5B45"); }
- OC代码
- (void)layoutSubviews { [super layoutSubviews]; _unreadLabel.backgroundColor = [UIColor hx_colorWithHexRGBAString:@"#FF5B45"]; }