ZacharyKhan / ZKCarousel

A simple carousel implementation written in Swift
MIT License
289 stars 57 forks source link

Facing cell reusable issue in Collection view #33

Closed AB91189 closed 4 years ago

AB91189 commented 4 years ago

HI,

I am using the ZKCarousel in a collection view. I am dequeresuing a collection view cell. The images are getting set from a URL array. if I scroll the collection view (fast) and the images are still downloading, the new collection view cell carousel is holding the image of the previous cell which is already loaded, and when the download completes it resets. I want to keep it blank till the image is downloading. Can you please suggest anything. Really really need help.

Thanks

ZacharyKhan commented 4 years ago

Hello @AB91189,

This is a common problem people have with UICollectionViews when asynchronously loading data (commonly images). There are a couple of things that you should note:

For me to help you with code, I would need to see your codebase to understand things like the state of your data and how you are managing the UI. You can add your own view to the cell and either 1) manage the state of the image yourself to show as blank until loaded, or 2) use a library such as SDWebImage to do the heavy lifting for you.

I would suggest using this library as a reference and writing your own to better suit your specific needs. ZKCarousel was not intended to be using with asynchronously loading images.