Using the answer from a previous question, I made an infinite scroll. However, I have a problem when scrolling.
It seems that for a millisecond, the UICollectionView
(or maybe the UIScrollView
for that matter) thinks the cells shown are not visible anymore, thus reuses the cells for new cells. This leads to cells being double used when scrolling.
The reason I believe this is the cause of my problem is because the "cheat" one uses in order to be able to infinite scroll is to reset the contentOffset
of the UIScollView
.
The cells of my UICollectionView
contain a background image which is downloaded asynchronously (of fetched from cache) using MKNetworkKit
.
One of the other side effects is that when scrolling a view "screen lenghts" in a row, the screen gets truncated. Almost as if a reloadData occurred in the UIScrollView
, yet the code doesn't reload the data at all.
My question is: How can I prevent the UICollectionView
from reusing visible cells and from truncating the view suddenly?
Have 2 reuse identifiers. When you reset the contentOffset
toggle between them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With