我是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"];