I found strange behavior in iOS 6, didn't test for other versions. I created a simple navigation based application with to views. when i click on a button on the first view, the second view is pushed. When then i click back button i return to the first view. Both views are nested from DetailViewConotrller.
@implementation DetailViewController
- (void)viewDidLoad
{
[super viewDidLoad];
UIBarButtonItem *searchCancelButton = [[UIBarButtonItem alloc] initWithTitle:@"custom1" style:UIBarButtonItemStyleBordered target:self action:nil];
[searchCancelButton setBackgroundVerticalPositionAdjustment:3 forBarMetrics:UIBarMetricsDefault];
UIBarButtonItem *searchCancelButton1 = [[UIBarButtonItem alloc] initWithTitle:@"custom2" style:UIBarButtonItemStyleBordered target:self action:nil];
[searchCancelButton1 setBackgroundVerticalPositionAdjustment:3 forBarMetrics:UIBarMetricsDefault];
[self.navigationItem setRightBarButtonItems: [[NSArray alloc] initWithObjects:searchCancelButton, searchCancelButton1, nil] animated:NO];
}
@end
I call method [self.navigationItem setRightButtonItems: animated:]
with animated parameter NO, but buttons are still animating. The interesting thing is, when this method is called with only one UIBarButtonItem it works correct and no annimation appears.
Are any thoughts why this method behaves such way? Is this a bug or do I something wrong? Or are any suggestions how to avoid animation for navigation items.