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

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

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

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -