2011-06-02 40 views
1

我不想提供太多细节,但我基本上正在做一系列的动画。我将一系列数字从屏幕的一侧移动到下一侧,但我不希望它们一次全部移动。我试图通过一个for循环和几个if循环来分解动画,但它不起作用。我认为使用sleep()命令会有所帮助,但它没有。你如何让动画在一个系列中运行而不是完全运行?试图弄清楚如何在Xcode中做一系列的动画

回答

0

UIView上使用animateWithDuration:delay:options:animations:completion:方法并设置延迟时间以错开动画。如果你想拥有他们跑了一个又一个,你可以在别人的完成块一个动画开始:

[UIView animateWithDuration:0.5 animations:^ 
{ 
    //Do your first round of animations here 
} completion: ^(BOOL completed) 
{ 
    //Start the next round 
    [UIView animateWithDuration:0.5 animations:^ 
    { 
     //second round of animations 
     //Nest this structure as deep as needed 
    } 
}]; 

您可以找到UIViewclass reference这一切的文档。

+0

哇,谢谢你的帮助!它看起来更像我现在想要的 – RaysonK 2011-06-02 23:55:33

相关问题