I try to set the alpha value of a navigationItem to animate the rightBarbutton, but I can´t get it change the value. Any suggestions?
self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc]
initWithTitle:@"Avbryt"
style:UIBarButtonItemStyleBordered
target:self action:@selector(cancelEditing)] autorelease];
self.navigationItem.rightBarButtonItem.customView.alpha = 0.5;
In your code you are trying to set alpha
for the rightBarButtonItem's customView
, but you your rightBarButton item doesn't contain any custom view. Isn't it?
UIBarButtonItem
item is a direct subclass of UIBarItem
which in turn is a subclass of NSObject
. So, it is not possible to set its alpha
directly. You are correct about setting alpha
for the customView
, but you have missed to add the customView itself ;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With