动画:如何在加载视图时使 UIbutton 从右向左移动? [英] Animation : How to make UIbutton move from right to left when view is loaded?

查看:25
本文介绍了动画:如何在加载视图时使 UIbutton 从右向左移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,我还没有用 iphone 开发任何动画.

I have not done any animation stuff with iphone development so far.

有人能帮我如何让 UIbutton 在视图加载时从右向左移动吗?

Can anybody help me how to make UIbutton move from right to left when view is loaded?

我想产生这样的效果:当视图加载时,按钮出现从右端向左移动&停在它的位置.可能吗?

I want to generate effect like that : when view is loaded, the button appears moving from right end to left & stops at its place. Is it possible?

感谢有关此动画内容的任何帮助.如果可用,请帮助提供一些示例.

Any help regarding this animation stuff is appreciated. Please help with some sample if available.

提前致谢.

推荐答案

为了让它更漂亮,我建议不要改变 UIView 的框架而是它的中心;

Just to make it even slicker, I would suggest not changing the UIView's frame but its center;

CGPoint newLeftCenter = CGPointMake( 20.0f + myButton.frame.size.width / 2.0f, myButton.center.y);
[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:1.0f];
myButton.center = newLeftCenter;
[UIView commitAnimations];

这篇关于动画:如何在加载视图时使 UIbutton 从右向左移动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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