I want a custom animation on the leftBarButtonItem:
UIBarButtonItem *menuButton = [[UIBarButtonItem alloc]
initWithTitle:@"Menu"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(onMenuButtonTouch)];
viewController.navigationItem.leftBarButtonItem = menuButton;
My UINavigationController pushes and pops views with a custom animation so the leftBarButtonItem doesn't have any animations at the moment.
[self.navigationController pushViewController:myViewController animated:NO];
[UIView animateWithDuration:...
-
First I changed a property the see if it is animated but that didn't work. Then I tried to set the property before the animation starts but that didn't work either. It takes absolutely no effect.
Is there a way to animate something like this for example?
self.navigationController.navigationItem.leftBarButtonItem.width = 10;
or
self.navigationController.navigationItem.leftBarButtonItem.customView.alpha = 0;
UIBarButtonItem
s are not a subclass ofUIView
so you can't apply animations on them butcustomView
is aUIView
object so you can animate it.