I am hiding the status bar and navigation bar in viewDidLoad
- (void)viewDidLoad {
[super viewDidLoad];
[self.navigationController setNavigationBarHidden:YES animated:YES];
[[UIApplication sharedApplication] setStatusBarHidden:YES];
}
Everything works fine. But then, when I dismiss the view controller, in viewWillDisappear: I do:
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
[[UIApplication sharedApplication] setStatusBarHidden:NO];
}
This causes my all the views to be badly positioned:

What am I doing wrong?
Thanks
I haven’t tried it so I’m just speculating.
Your navigation bar has a frame set as if there is no
Status bar. Something is done in the wrong order.So in your code I see that when the navigation bar is asked to be made visible when there is no status bar present.
Have you tried inverting those 2 lines? ( I’m only guessing )
My other test would be to set the navigation bar visible in the viewDidAppear.
At that time the applicationFrame should have updated to the fact that the status bar is visible again.
I’ve tested it, and inverting the call make it work. But you won’t get animation for the navigation bar and status bar. If you want them I suggest placing your those call in
viewWillAppearor inviewDidAppear