从一个图像到另一个图像制作一个UIButton动画 [英] Animate a UIButton from one image to another

查看:64
本文介绍了从一个图像到另一个图像制作一个UIButton动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Jamie Oliver应用程序中注意到,当您单击其中一个按钮时,它会在平滑过渡中从一种尺寸变为另一种尺寸.有人知道这是怎么做的吗?我尝试使用某些UIView动画,但没有一个可以满足我的需求.

I noticed 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不能单独给您带来这种效果.您需要将它们与转换结合起来以实现您所讨论的效果.请按照以下方式尝试.您将得到所需的东西...

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];

这篇关于从一个图像到另一个图像制作一个UIButton动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆