使用多级块动画 [英] Multistage animation using blocks

查看:92
本文介绍了使用多级块动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道你可以使用块像这样进行两阶段animataion:

I know you can perform a two-stage animataion using blocks like so:

[UIView animateWithDuration:25.0 delay:0.0 options:UIViewAnimationCurveLinear animations:
     ^{ 
         aView.alpha = 2.5;         
     } 
         completion:^(BOOL finished)
     {
         aView.hidden = YES; 
     }
 ];

..但我将如何创建一个使用块多级(大于2)动画?

..but how would I create a multistage (more than 2) animation using blocks?

推荐答案

使用嵌套的动画:

[UIView animateWithDuration:0.5 
                      delay:0.0 
                    options:UIViewAnimationOptionBeginFromCurrentState 
                 animations:^{
                     //first animation
                 }
                 completion:^(BOOL finished){[UIView animateWithDuration:0.5 
                                                                   delay:0.0 
                                                                 options:UIViewAnimationOptionBeginFromCurrentState 
                                                              animations:^{
                                                                  //second animation
                                                              }
                                                              completion:^(BOOL finished){//and so on..
                                                              }];}];

这篇关于使用多级块动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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