开发者

Making an icon "jump" with iPhone core animation

开发者 https://www.devze.com 2022-12-18 14:38 出处:网络
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 ha

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号