UICollectionView + SDWebImage + Cell reuse

前端 未结 5 589
再見小時候
再見小時候 2021-01-06 03:39

I have a UICollectionView with a custom UICollectionViewCell class which adds another UIView (thumbnailView) to its contentView. This other view has a UIImageView property (

5条回答
  •  天命终不由人
    2021-01-06 04:31

    Swift 4 - Add to your cell's class:

    override func prepareForReuse() {
      super.prepareForReuse() 
      self.contentImageView.sd_cancelCurrentImageLoad()
      self.contentImageView.image = UIImage(named: "") // set to default/placeholder image
    }
    

提交回复
热议问题