ChrisP
ChrisP

Reputation: 10116

Why are there different animations with setNavigationBarHidden?

In my viewDidAppear method I call

[self.navigationController setNavigationBarHidden:YES animated:YES];

and the navigation bar is hidden by sliding it to the left. However, if I detect a tap gesture then do the following

if([self.navigationController isNavigationBarHidden]){
  [self.navigationController setNavigationBarHidden:NO animated:YES];
} else {
  [self.navigationController setNavigationBarHidden:YES animated:YES];
}

the navigation bar is shown/hidden by sliding it up/down from the top of the screen. Am I doing something to cause the different types of animation or is this the expected behavior?

Upvotes: 1

Views: 1184

Answers (1)

FeltMarker
FeltMarker

Reputation: 510

It seems that it depends on the state of the VC.

If a VC shows or hides the navigation bar in ViewWillAppear, the navcon animates the (dis)appearance of the bar in coincide with the appearance of the new VC.

Also see comments in: changing the direction that the hide animation moves a navigationBar

Upvotes: 1

Related Questions