views:

271

answers:

1

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 matter 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.

+1  A: 

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.

Brad Larson
Thanks, that fixed my problem! It seems the fillMode made all the difference!
Jason