CollectionView duplicate cell when loading more data

后端 未结 2 973
有刺的猬
有刺的猬 2020-12-10 03:54

The problem:

I have a CollectionView which loads a UIimage into each cell. However my problem is that when I load additional cells with more images

2条回答
  •  执念已碎
    2020-12-10 04:30

    in your custom cells setupData() method try the following:

    func setupData(){
      self.imageView.image = nil // reset the image
    
      if let urlString = data{
        let url =  NSURL(string: "http://image.tmdb.org/t/p/w342/" + urlString)
        self.imageView.hnk_setImageFromURL(url!)
      }
    }
    

提交回复
热议问题