I have sub classed UICollectionViewFlowLayout
, and in that sub class, I'm changing the UICollectionViewLayoutAttributes
frames, so that they would appear larger or smaller - depending on their position on screen.
I'm performing the frame changes in layoutAttributesForElementsInRect
:
And as well returning it in layoutAttributesForItemAtIndexPath
:
I'm returning YES in shouldInvalidateLayoutForBoundsChange
:
All is working well, but the cells do not animate the changes of the frame.
Am i missing Something? Why are the changes are not being animated?
Thanks.
SOLVED.
There is no "animation function", or anything similar, since changing the frames of items of a collection view inside your own custom (flow) lay out just can't be animated.
The solution to the problem is writing an algorithm that calculates all the relevant frames that the method layoutAttributesForElementsInRect: provides, so that setting the frame of an item will respectfully set another item's frame an will compensate for the added size, or reduced size.
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