动画:如何在加载视图时使UI按钮从右向左移动?

Ram*_*mbo 16 iphone animation

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

任何人都可以帮助我在加载视图时如何让UI按钮从右向左移动?

我希望产生这样的效果:加载视图时,按钮会从右端移动到左边并停在其位置.可能吗?

任何关于这个动画的帮助都值得赞赏.请提供一些样品帮助.

提前致谢.

Til*_*ill 32

为了使它更加光滑,我建议不要改变UIView的框架,而是改变它的中心;

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];
Run Code Online (Sandbox Code Playgroud)