Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid UIBarButtonItem fade out / fade in during pushViewController animation

I have in my only-ios5 application a navigationControllerDelegate:

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    UIBarButtonItem *myButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"common-settingsbutton"] style:UIBarButtonItemStylePlain target:nil action:nil];
    [viewController.navigationItem setRightBarButtonItem:myButton]; 
}

It works, but when a push view controller with default animation occurs (i.e. using a "push segue") the rightBarButtonItem fadeout and fadein during animation.

How can I avoid this?


UPDATE

The only workaround I found is:
create UINavigationBar background with same UIBarButtonItems drawn in png (in the same position, same color) and set background correctly based on buttons I need. Then, of course, add your UIBarButtonItems.

like image 303
Giorgio Marziani de Paolis Avatar asked Feb 17 '12 11:02

Giorgio Marziani de Paolis


1 Answers

The only workaround I found is: create UINavigationBar background with same UIBarButtonItems drawn in png (in the same position, same color) and set background correctly based on buttons I need. Then, of course, add your UIBarButtonItems.

like image 200
Giorgio Marziani de Paolis Avatar answered Sep 21 '22 23:09

Giorgio Marziani de Paolis