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

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

.net - Bulk insert via Dapper is slower than inserting rows one-by-one -

shared memory - gstreamer shmsrc and shmsink with h264 data -