美文网首页iOS基础
点击cell时subView背景色消失

点击cell时subView背景色消失

作者: 伏特加 | 来源:发表于2016-06-28 16:43 被阅读43次

在自定义cell中使用如下方法:

- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
    UIColor *backgroundColor = self.subView.backgroundColor;
    [super setHighlighted:highlighted animated:animated];
    self.subView.backgroundColor = backgroundColor;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    UIColor *backgroundColor = self.subView.backgroundColor;
    [super setSelected:selected animated:animated];
    self.subView.backgroundColor = backgroundColor;
}

相关文章

网友评论

    本文标题:点击cell时subView背景色消失

    本文链接:https://www.haomeiwen.com/subject/gwutjttx.html