문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top