Take the 2-minute tour ×

I have an issue with my navigation bar.

The first screen of my app is a welcome screen, with two classic buttons in the center of the screen. No bars (tab or nav, and status is hidden with the setStatusBarHidden in the viewDidLoad). I only implemented one of the buttons but both will work the same way (the two screens are similar). So the first button loads up a "sign up" screen (a UITableViewController) with a form to fill in. There, the status bar is shown, and I added a navigation bar (in the attributes panel of my view controller), with a "send" button on the top right.

In the attributes panel of my "navigation item" (as it's called), I entered a name for the back button, which is correctly displayed (although I'd like to change the name, but I'll do it later).

My problem is that when I hit the back button, it takes me back to the "welcome" screen but the status bar is not hidden, there is a nav bar with no title and no buttons, and I can't find a way to hide them. I tried using viewDidLoad, viewDidAppear, viewDidUnload (in the sign up view) but nothing works (I can hide the status bar, but the view is loaded so there is a black space between the non-hidden nav bar and my content).

By the way, I have done most of the design using the storyboard, not with code, but I don't mind using both.

Can anybody help ? Thanks.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Hide the status bar and navigation bar in viewWillAppear: method and not in the viewDidLoad: method.If your dont want to show status bar or navigation bar,put that code in AppDelegate Class.


This will hide your navigation bar in your View controller.Put it in viewWillAppear:

self.navigationController.navigationBarHidden = YES;

This hides your status bar.

[[UIApplication sharedApplication] setStatusBarHidden:YES animated: UIStatusBarAnimationNone];

Your view controller should have wantsFullScreenLayout set to YES, as well as hiding the status bar.Black space is showing your view is automatically didn't resized when you dont have status bar or navigation bar.you need to check auto-sizing in the storyboard "size inspector" in the right side pane tabs.

Edit 1: This will hide your bars with animation:

[self.navigationController setNavigationBarHidden:YES animated:YES];
[[UIApplication sharedApplication]setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
share|improve this answer
Thanks for your answer, I added '[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];' in the viewWillAppear, but the problem remains. When I come back, the status bar is hidden, but it left an empty black space, and I also don't know how to hide the nav bar (didn't find any 'setNavigationBarHidden' or anything..), so my whole view is lowered... –  rdurand Jul 17 '12 at 11:12
check my edited answer. –  Dinesh Raja Jul 17 '12 at 11:33
Thanks, I'm facing another unrelated problem that I need to fix to try this. I'll give feedback and select your answer if it worked ! :) –  rdurand Jul 17 '12 at 11:50
sure..Pleasure to help.:-) –  Dinesh Raja Jul 17 '12 at 11:55
So the main problem is gone, but it's not perfect.. lol. The back button creates a push (left to right ? like a back-slide) but just before the animation starts, the status bar and the nav bar are hidden. It's not terrible but easily noticeable. Any ideas/suggestions ? Thanks again for the quick help –  rdurand Jul 17 '12 at 12:19

Your Answer


