Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Toolbar buttons flashing (quick fade out in) when pushing view controller animated

When pushing a view controller my toolbar buttons fade out and then in again with the new view. The problem is that i have the same buttons in the next view as the previous so it looks like the buttons do a quick flash when switching screen. My question is if this can be avoided by disable the fade out of toolbar buttons for the navigation controller when pushing to a new view or if the toolbar can be bound to the navigation controller in such a way that it is the same for all views. The last suggestion since i have seen that my navigation bar buttons does not fade out when pushing a new screen.

like image 338
Alzorz Avatar asked Mar 23 '13 15:03

Alzorz


1 Answers

I'm surprised that nobody answered you. I've just faced this issue, and here's a solution I've found.

  1. Subclass your navigation controller

  2. Override you push/pop methods

-(UIViewController*)popViewControllerAnimated:(BOOL)animated
{
    self.navigationBarHidden = YES;
    UIViewController *vc = [super popViewControllerAnimated:animated];
    self.navigationBarHidden = NO;
    return vc;
}

-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    self.navigationBarHidden = YES;
    [self pushViewController:viewController animated:animated];
    self.navigationBarHidden = NO;
}

It did the trick for me.

like image 61
ilnar_al Avatar answered Oct 06 '22 08:10

ilnar_al