在给cell上的子视图设置backgroundColor后,当点击cell时会发现子视图的背景色消失了,解决这个问题只需重写cell的下面的这两个方法就可以了。
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
self.noteViewTop.backgroundColor = [UIColor blackColor]; //设置子视图背景色
}
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
[super setHighlighted:highlighted animated:animated];
self.noteViewTop.backgroundColor = [UIColor blackColor]; //设置子视图背景色
}
网友评论