iphone – 停止一系列基于块的动画的最佳方法是什么

iphone – 停止一系列基于块的动画的最佳方法是什么,第1张

概述假设有一系列基于块的动画,如下所示: UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];//animation 1[UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionCurveLinear animations:^ 假设有一系列基于块的动画,如下所示:

UIVIEw * vIEw = [[UIVIEw alloc] initWithFrame:CGRectMake(0,200,200)];//animation 1[UIVIEw animateWithDuration:2 delay:0 options:UIVIEwAnimationoptionCurvelinear animations:^{     vIEw.frame = CGRectMake(0,100,200);} completion:^(BOol finished){     //animation 2     [UIVIEw animateWithDuration:2 delay:0 options: UIVIEwAnimationoptionRepeat |UIVIEwAnimationoptionautoreverse animations:^{          [UIVIEw setAnimationRepeatCount:1.5];          vIEw.frame = CGRectMake(50,200);        } completion:^(BOol finished){          //animation 3          [UIVIEw animateWithDuration:2 delay:0 options:0 animations:^{               vIEw.frame = CGRectMake(50,200);          } completion:nil];     }];}];

什么是阻止这种动画的最佳方法?只是打电话

[vIEw.layer removeAllAnimations];

是不够的,因为它只停止当前正在执行的动画块,其余的将按顺序执行.

解决方法 您可以查询传入完成块的已完成BOol.在您调用removeAllAnimations的情况下,它将为NO. 总结

以上是内存溢出为你收集整理的iphone – 停止一系列基于块的动画的最佳方法是什么全部内容,希望文章能够帮你解决iphone – 停止一系列基于块的动画的最佳方法是什么所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1084323.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存