如何让动画按顺序执行?

现在需要实现一系列动画特效

把动画代码放到 block 动画中执行?

[UIView animateWithDuration:1.0 animations:^{
            self.countDownView.center = CGPointMake(self.view.center.x, self.view.center.y - 150);
        } completion:^(BOOL finished) {}
        ];

放进 completion 是可以保证顺序执行 但是动画一多嵌套会很深,看起来也不方便。
如果只在 animation 中写,动画会同时执行。
有啥解决办法么?

阅读 6.8k
3 个回答

设置delay

UIView animateWithDuration:<#(NSTimeInterval)#> delay:<#(NSTimeInterval)#> options:<#(UIViewAnimationOptions)#> animations:<#^(void)animations#> completion:<#^(BOOL finished)completion#>
新手上路,请多包涵

也可以试试组动画

放到一个group里

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题