如何为UILabel的运动设置动画 [英] How to animate the movement of a UILabel

查看:120
本文介绍了如何为UILabel的运动设置动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在应用程序中移动UILabel,我希望它在几帧内更改位置和大小,而不是跳转位置。我正在为iPhone使用Objective-c和可可粉开发。有人可以帮我吗?

I am moving a UILabel around in my app and I would like it to change location and size over a few frames instead of jumping location. I am using Objective-c and cocoa developing for the Iphone. Can anyone help me out?

推荐答案

最简单的方法是:

    CGRect endFrame = /*The frame of your label in end position*/

    [UIView animateWithDuration:0.5 animations:^{ 
        myLabel.frame = endFrame;
   }];

这篇关于如何为UILabel的运动设置动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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