I want to do the animation introduced by Android Material Design Hierarchical Timing in iOS using UICollectionView
Lets say its a collectionView, and resizing the view is not an issue, what would be the best practice to do this animation in that timely fashion. How to perform the delay
One way to do this would be to add the cells one at a time with a timer, and have those cells expand to full size as they come on to the window.
In the custom cell class,
The project can be found here, http://jmp.sh/aDw846R
Something like this should work. Random pieces thrown together, I know.
Here's a very well done pen of what you're describing. In it you'll find that the timing function in question is the curve, defined in CSS as:
Knowing the timing function, you can implement this animation in iOS. Here's a link to another question -- it shows how to pull off custom animations and is very well explained.
Custom timing functions in iOS
May take some simple math, but this should help! ...i hope.
cheers
Subclass your collection view cell and add this method:
Set your collection view's
delegate
anddataSource
to your view controller (this can be done in Interface Builder). Add constants to your view controller and reload collection view inviewDidAppear
to animate cells:Add extension to your view controller for UICollectionView datasource & delegate:
You can adjust
baseDelay
and animation duration in Cell'spopAfter
values to achieve desired timing. Hope this helps and good luck with your app! Feel free to ask any questions.