我试图将此动画应用于UIBarButtonItem:
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"opacity"];
theAnimation.duration=1.0;
theAnimation.repeatCount=HUGE_VALF;
theAnimation.autoreverses=YES;
theAnimation.fromValue=[NSNumber numberWithFloat:1.0];
theAnimation.toValue=[NSNumber numberWithFloat:0.5];
[plusbutton.layer addAnimation:theAnimation forKey:@"animateOpacity"];
Run Code Online (Sandbox Code Playgroud)
但是我在最后一行代码的标题中报告了错误.如何访问barbuttonItem的图层?