CABasicAnimation无法在iOS 9中运行

时间:2015-10-05 11:38:21

标签: ios objective-c xcode cabasicanimation caanimation

我只想为视图的背景颜色设置动画。我到目前为止所做的是:

CABasicAnimation *backgroundColorAnimation = [CABasicAnimation animationWithKeyPath:@"backgroundColor"];
backgroundColorAnimation.duration = 1.0;
backgroundColorAnimation.beginTime = CACurrentMediaTime() + 0.5;
backgroundColorAnimation.repeatCount = HUGE_VALF;
backgroundColorAnimation.autoreverses = YES;
backgroundColorAnimation.fromValue = (id)[[UIColor whiteColor] CGColor];
backgroundColorAnimation.toValue = (id)[[UIColor redColor] CGColor];
[self.layer addAnimation:backgroundColorAnimation forKey:@"animation.backgroundColor"];

以上工作适用于iOS 8但不适用于iOS 9.对已发生变化的任何帮助?

0 个答案:

没有答案