我正在尝试将此动画应用于 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"];
但我得到了最后一行代码标题中报告的错误。如何访问 barbuttonItem 的层?