You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 17, 2023. It is now read-only.
I have 10 UICollectionViewCell (each with an image inserted) in UICollectionView, and initially due to restrictions on the rate of downloading images I had reduced the number of visible items to 5 layout.numberOfVisibleItems = 5
When I go to change my data model and do a full reload of the UICollectionView, depending on what UICollectionViewCell Im on....ie the value for layout.currentPage and layout.currentScrollOffset determines which 5 cells will be loaded in memory after the reloadData()....
.e.g. currentPage is 9, do a reloadData(), and cells 5,6,7,8,9 are loaded into memory. then I setCurrentPage() to 2
for the UICollectionViewCells 0 and 1 behind page 2, the images displayed are from the recycled UICollectionViewCell taken from memory like if they were cached - even though the new images have been downloaded again and set in the imageView in the UICollectionViewCell
Initially I was thinking:
could be an issue between the reloadData() call and setCurrentPage() but these are both performed on the main thread.
I played around with forcing invalidateLayout() before and after the reloadData()
I was thinking if I should reset layout.currentPage before doing the reload.
But when I don't set layout.numberOfVisibleItems and leave it at the default, the issue with showing the wrong images behind the currentPage does not happen. There is also no need for invalidateLayout() here
So I am wondering if I'm missing something when using layout.numberOfVisibleItems or if there is a bug there
The text was updated successfully, but these errors were encountered:
Hi,
the way that you use numberOfVisibleItems seems okay, I think the issue is about invalidating, could you try invalidating layout via performBatchUpdates like this?
if this didn't work, can you make a simple project and share it here, it's probably not related to downloadable images!
it might be a bug but I need to find a way to reproduce it.
Thanks for the response, I had tried the way you suggest... the same way as its done in viewDidLayoutSubviews() method but it had the same problems. By the way I was using the configuration for the inverted cylinder which I took from the mac layout designer app. I will look at creating a sample project to reproduce the issue.
Hi Jonathan,
With the new version the issue should be fixed, no need to call performBatchUpdates or invalidateLayout anymore,
Check the version 1.0.0 or higher and feel free to open a new ticket if needed
I have 10 UICollectionViewCell (each with an image inserted) in UICollectionView, and initially due to restrictions on the rate of downloading images I had reduced the number of visible items to 5
layout.numberOfVisibleItems = 5
When I go to change my data model and do a full reload of the UICollectionView, depending on what UICollectionViewCell Im on....ie the value for
layout.currentPage
andlayout.currentScrollOffset
determines which 5 cells will be loaded in memory after the reloadData().....e.g. currentPage is 9, do a
reloadData()
, and cells 5,6,7,8,9 are loaded into memory. then IsetCurrentPage()
to 2for the UICollectionViewCells 0 and 1 behind page 2, the images displayed are from the recycled UICollectionViewCell taken from memory like if they were cached - even though the new images have been downloaded again and set in the imageView in the UICollectionViewCell
Initially I was thinking:
reloadData()
call andsetCurrentPage()
but these are both performed on the main thread.invalidateLayout()
before and after thereloadData()
layout.currentPage
before doing the reload.But when I don't set
layout.numberOfVisibleItems
and leave it at the default, the issue with showing the wrong images behind the currentPage does not happen. There is also no need forinvalidateLayout()
hereSo I am wondering if I'm missing something when using
layout.numberOfVisibleItems
or if there is a bug thereThe text was updated successfully, but these errors were encountered: