无限循环动画 [英] Infinitely looping animation
本文介绍了无限循环动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建无限循环动画,但遇到了一些麻烦。我正在使用这行代码使我的视图悸动红色,但是当我调用此行时,它可以工作,但是我的UI没有响应。
I am trying to create an infinitely looping animation but am having some trouble. I am using this line of code the make my view "throb" red but when I call this line it works but make my UI unresponsive.
[UIView animateWithDuration:1.0f
delay:0.0f
options:(UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat)
animations:^{
self.backgroundColor = [UIColor colorWithRed:0.5 green:0.0 blue:0.0 alpha:1.0];
}
completion:nil];
我的问题是:1)这是正确的方法吗? 2)为什么这会使UI无响应?
My questions are: 1)is this the correct way to do this? 2)why does this make the UI unresponsive?
推荐答案
您的选项需要包含 UIViewAnimationOptionAllowUserInteraction
。默认情况下,UIView动画在运行时禁用输入。
Your options need to include UIViewAnimationOptionAllowUserInteraction
. By default, UIView animations disable input while they're running.
这篇关于无限循环动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文