ios - View updates too late in Collection View after scrolling -


i have collectionview image inside each cell. when i'm scrolling collection, new cell (indexpath = 10) contains image old cell (indexpath = 1), calls method:

func collectionview(_ collectionview: uicollectionview, cellforitemat indexpath: indexpath) -> uicollectionviewcell {  } 

and set image url new view. best way hide old image after scrolling before update?

you need clean images in collectionviewcell upon reusing them. override prepareforreuse function in collectionviewcell subclass.

  override func prepareforreuse() {         super.prepareforreuse()         // set cell's imageview's image nil         self.imageview.image = nil     } 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -