1

I am doing custom push transition from controller A to controller B. In Controller A, navbar is hidden but it is visible in Controller B. When I am doing the custom transition, navigation bar immediately appears at the beginning of the transition. How can I prevent this?

Here are some code pieces:

In controller A, navigation bar is hidden with following code:

- (void)viewWillAppear:(BOOL)animated
{
    [self.navigationController setNavigationBarHidden:YES animated:NO];
    [super viewWillAppear:animated];
} 

Also, in controller A, I am starting the custom push transition with following code:

{
    ...

    NOZViewController *vc = (NOZViewController *)[self.storyboard instantiateViewControllerWithIdentifier:@"gameController"];

    [self.navigationController pushViewController:vc animated:YES ];
}

As soon as the custom transition starts, I see the navigation bar of controller B! Here is how I get the snapshots for custom animation code for transition:

{
    ...
    NOZMainViewController *fromViewCtrl =
        (NOZMainViewController *)[transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
    UIView *fromSnapshot =  [fromViewCtrl.view snapshotViewAfterScreenUpdates:NO];

    NOZViewController *toViewCtrl =
        (NOZViewController *)[transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];

    UIView *toViewSnapshot = [toViewCtrl.view snapshotViewAfterScreenUpdates:YES];
    ....

}
Nihat
  • 3,055
  • 3
  • 18
  • 28
  • for your toViewSnapshot, what if you took the snapshots with `snapshotViewAfterScreenUpdates:NO` instead of yes? Is the nav bar of your toViewCtrl supposed to have a nav bar visible? – chetem May 09 '14 at 12:51
  • I tried both and it does not help – Nihat May 09 '14 at 13:32

1 Answers1

0

I set the navigationbar to hidden with animation and that solved the sudden appearance of navbar syndrome

- (void)viewWillDisappear:(BOOL)animated
{
    [self.navigationController setNavigationBarHidden:NO animated:YES];
    [super viewDidDisappear:animated];
}
Nihat
  • 3,055
  • 3
  • 18
  • 28