Set alpha value of NavigationItem
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.c开发者_如何学JAVAustomView.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 ;-)
精彩评论