UIView backgroundColor disappears when UITableViewCell is selected

前端 未结 17 814
谎友^
谎友^ 2020-11-30 17:49

I have a simple tableViewCell build in interface builder. It contains a UIView which contains an image. Now, when I select the cell, the default blue selection background is

17条回答
  •  有刺的猬
    2020-11-30 18:33

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

提交回复
热议问题