Post

Replies

Boosts

Views

Activity

UICollectionViewLayout Incorrect After Reload
Hi there, I have a carousel, similar to https://stackoverflow.com/questions/35045155/how-to-create-a-centered-uicollectionview-like-in-spotifys-player. When reloadData is called, layoutAttributesForElements is called inside my UICollectionViewFlowLayout subclass, and a transform3D is set for the UICollectionViewLayoutAttributes of one of the CollectionView cells. This transform seems to be calculated correctly, but doesn't get applied. However, when I start to scroll, the transform gets applied immediately (the cell resizes). If it helps, I have a tab bar, so when I toggle away from and back to the tab with the CollectionView, an API call is made, and then reloadData is called on the CollectionView. The cell then jumps from having the transform to not having it. Then when I scroll, the cell jumps from not having the transform, to having it. How do I ensure that the transform gets applied immediately after calling reloadData?
0
0
290
Mar ’22