Shabarinath Pabba
Shabarinath Pabba

Reputation: 1369

Collection view Cell Animations

I am trying to animate UICollectionviewCells as they are created. I wanted to give each collectionviewcell a frame whose origin would be outside the phone and then I try to animate them, the way I wanted to do this was to use animate with duration and save their actual frames so that I can have the collectionviewCells animate to the so called "actual frames", the problem now is that, so I make one collectionViewcell in one section, so every collectionviewcell has "0" as its origin for the "actual frame", I won't be able to get the correct frames on the screen to animate a uicollectionview cell too. Would anyone have any suggestion for me to achieve the animation?

Upvotes: 0

Views: 1078

Answers (1)

Jinghan Wang
Jinghan Wang

Reputation: 1137

You may want to check this link: http://www.objc.io/issue-12/collectionview-animations.html.

The standardized idea is to subclass UICollectionViewLayout and then implement the method initialLayoutAttributesForAppearingItemAtIndexPath: to provide the initial positioning properties of the cells.

P.S. Other animations (when you remove a cell or when you rotate your device) are also talked about in the post. Read them if you are interested.

Upvotes: 2

Related Questions