1

When my app returns from background, the UIViewController jumps down the height of the UINavigationBar (44 pixels).

Everything is being controlled through a story board using push segues.

Even when I NSLog the frame of both the view controller and the navigation controller after the "jump", using NSStringFromCGRect, they both show (0,0,320,480) as their frame, even though its clearly not the case.

Before:

enter image description here

After returning from background:

enter image description here

cohen72
  • 2,830
  • 29
  • 44
  • 1
    Do you change the top bar translucency in your code, or in interface builder ? – streem Apr 08 '14 at 08:14
  • The view size remains that of the full screen in iOS7, regardless of whether the navigation bar is showing or not. – ZeMoon Apr 08 '14 at 08:16
  • I do change the top bar translucency on viewWillAppear of the view controller. 2 seconds after I wrote the question I noticed this was the problem, and 2 seconds later @erhnby posted the same answer. – cohen72 Apr 08 '14 at 08:25

1 Answers1

2

You can use this code for hide navigation bar in YourViewController

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:YES];
    [self.navigationController.navigationBar setHidden:YES];
}
Erhan
  • 908
  • 8
  • 19