在給cell上的子視圖設(shè)置backgroundColor后,當(dāng)點(diǎn)擊cell時(shí)會(huì)發(fā)現(xiàn)子視圖的背景色消失了,解決這個(gè)問(wèn)題只需重寫cell的下面的這兩個(gè)方法就可以了。
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
self.noteViewTop.backgroundColor = [UIColor blackColor]; //設(shè)置子視圖背景色
}
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated {
[super setHighlighted:highlighted animated:animated];
self.noteViewTop.backgroundColor = [UIColor blackColor]; //設(shè)置子視圖背景色
}