property layer not found on object of type UIBarButtonitem
ios
Solution
A bar button item isn't a view, and it doesn't have a layer.
Assuming you're not trying this on a system item, access the layer of the item's `customView` instead.
Problem
I am trying to apply this animation to a 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"]; ``` but I get the error reported in the title on the last line of code. How can I access the layer of a barbuttonItem?