Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top