我是ios开发的新手。我在我的项目中使用轮子图像。动画在前景模式下工作正常。之后我按下主页按钮。现在我重新启动应用程序,滚轮动画不起作用。这是我的代码:
CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; animation.fromValue = [NSNumber numberWithFloat:0.0f];
animation.toValue = [NSNumber numberWithFloat: 2*M_PI];
animation.duration = 1.0f;
animation.repeatCount = INFINITY;
[imageLeft.layer addAnimation:animation forKey:@"SpinAnimation"];
斯威夫特 4.2 更新
啊,我想通了 - 使用这个,所有像进入后台后停止的情况都将得到解决。
animation.isRemovedOnCompletion = false
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)