我只想为视图的背景颜色设置动画。我到目前为止所做的是:
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.对已发生变化的任何帮助?