0

In my iPhone application, the default orientation throughout the app is Landscape mode. I wanted to hide the status bar, so I used [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; in the appDelegate. But the status bar is hidden only in the first splash screen, and in the view controller it leaves a white space in the top and in the all other view controllers it is leaving a white space in the bottom. I used following methods to solve the issue, but didn't work.

  1. [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];

  2. In the info.plist Status bar is initially hidden = YES

  3. Set the status bar is equal to None in the interface builder.

  4. Added [self.view setNeedsLayout];
    [self setWantsFullScreenLayout:YES];

Still its not fixed. Any idea? Please help.

Hector
  • 3,909
  • 2
  • 30
  • 46
Mithun
  • 459
  • 1
  • 10
  • 32
  • I tried using [application setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone] and for me it is working fine.How are you assigning view controller frame? – Nuzhat Zari May 31 '12 at 12:26
  • i am not assigning the frame through code, i have added the views to the view in the interface builder file. – Mithun May 31 '12 at 12:36
  • did you remove status bar from the xib? may be `setStatusBarHidden:YES` function just called for portrait mode, try that for all orientation mode, i dont have any other idea about this. – relower May 31 '12 at 13:14
  • i tried that too, still not working. – Mithun May 31 '12 at 13:21

2 Answers2

2

Found the solution, to hide the status bar [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone]; is enough. But still there was a white space. As I was added the views to the view controllers through Interface Builder, the frame size of each views not getting adjusted automatically when the status bar got hidden. So, I had to set the Autoresizing directions in the Size Inspector in Interface Builder for each views. That fixed the issue. Hope it will be helpful for some one, thats why I am posting the answer here. :)

Mithun
  • 459
  • 1
  • 10
  • 32
0

Open your .plist file and add a new key "Status bar is initially hidden" then set a value as YES. I hope that helps you.

hightech
  • 3,742
  • 3
  • 25
  • 36