Search code examples
objective-cuitableviewanimationuinavigationbarnavigationitem

Navigation bar. Right bar button doesn't animate


Im adding a right bar button to my navigation bar. It appears and it works fine.

The problem is that it´s not animated. I mean, when I move to other views by clicking in some row, it just suddenly pops out and you can see the new view moving behind it until the sliding animation is finished.

UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:@"Close"style:UIBarButtonItemStylePlain target:self    action:@selector(closePopOver)];
[self.navigationItem setRightBarButtonItem: closeButton animated:YES];
[closeButton release];

And I add it in the initWithNibName: method. I´ve tried to move it to the viewDidLoad and it didn't work.

Any ideas?


Solution

  • There are specific methods you can use to animate the right bar button items:

    [self.navigationItem setRightBarButtonItem: self.addToOrderButton animated:YES];