tags:

views:

86

answers:

0

In my current UINavigationController, the viewControllers stack looks like this. 1 -> 2 -> 3. Before transitioning from the 2nd to the 3rd controller however, I pop the 2nd one first so that when the 3rd controller is popped, the 1st controller is on top.

[self.navigationController popViewControllerAnimated:NO];
[self.navigationController pushViewController:controller animated:YES ] ;

But somehow doing this changes the navigationBar's color from the original blue default to the black style. Explicitly setting the barStyle to UIBarStyleDefault in the new controller's viewWillAppear or viewWillDisappear has no effect. What's stranger, if I set the barStyle at all, even the 1 -> 2 transition will cause the bar color to change to black.

By the end of writing this post, I realized that the following code fixed it.

navBar.barStyle = UIBarStyleDefault-1;

Why would I need to subtract 1 from the default to actually obtain the default color?