开发者

Animate a UIButton from one image to another

I noti开发者_如何学Cced in the Jamie Oliver app, when you click one of the buttons, it goes from one size to another in a smooth transition. Does anyone know how this is done? I tried using some of the UIView animations, but none of them satisfies my needs.


UIAnimations alone can not give you that effect.. You need to couple them with transformations to achieve the effect that you are talking about. Try it in the following way. You will get what you need...

[UIView beginAnimations:@"Zoomin" context:nil];

[UIView setAnimationDuration:0.25];
starImage.transform=CGAffineTransformMakeScale(2.5, 2.5);
[UIView commitAnimations];
[UIView beginAnimations:@"Zoomout" context:nil];
[UIView setAnimationDuration:0.25];
starImage.transform=CGAffineTransformMakeScale(1, 1);
[UIView commitAnimations];


I believe animation blocks are the preferred method for animating views now.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜