Making an icon "jump" with iPhone core animation
What would be the best way to make an icon seem to "jump" from a toolbar into a UITabBarItem.
I have found the CAKeyframeAnimation class which looks promising but I just can't get it to work. I have been using code similar to this : http://www.bdunagan.com/2009/04/26/core-animation-on-the-iphone/ but no matt开发者_JAVA百科er what I set my endPoint to, the icon always ends up in the top of the screen.
I'm trying to achieve something similar to the effect used when you move a message in the Mail application. Is CAKeyframeAnimation suitable or is there an easier way to do this?
Thanks in advance.
When you say "the icon always ends up in the top of the screen", do you mean that the animation runs, but the icon hops back to the top of the screen at its completion? If so, make sure that you've set the animation's fillMode
to kCAFillModeForwards
and its removedOnCompletion
property to NO
.
For another example of a CAKeyframeAnimation that animates an object along a curve, see my answer to this question.
精彩评论