11
votes

My iPhone app requires that the status bar be hidden at all times. This is generally easy to do, and it works if I only run the app on an iPhone. However, if I run the app on an iPad, the status bar still appears at the top of the content. So, how do I make sure the status bar is hidden no matter device my iPhone-only app is running on? I'm currently doing the following in my code:

Calling this method for each view controller(I actually created a category on UIViewController that implements this automatically for any VC, but it's basically the same as writing it in each vc file):

-(BOOL)prefersStatusBarHidden{
    return YES;
}

I also set "status bar is initially hidden" to YES and "View controller-based status bar appearance" to NO in Info.plist. I've also tried detecting which device is being used and calling

[UIApplication sharedApplication]setSetStatusBarHidden:YES]

in the AppDelegate, but no luck there either. So, I believe I've tried just about everything that one would think to try.

3
I'm basically trying everything. Writing prefersStatusBarHidden in view controllers, setting "status bar is initially hidden" to YES and "View controller-based status bar appearance" to NO in Info.plist. I've also tried detecting which device is being used and calling [UIApplication sharedApplication]setSetStatusBarHidden:YES], but no luck there either. Just using prefersStatusBarHidden alone on my view controllers works when run on iPhonemike
If I make this an Universal app, then my code works and the status bar is hidden on iPad. But, this app isn't meant to be universal, so this isn't a viable solutionmike
Well if you're setting prefersStatusBarHidden, "View controller-based status bar appearance" should be set to YES, you may already know this but you worded it a little strange.Milo
Sorry, I meant to say that I've tried setting that key to both YES and then NO, but neither helps.mike
check your code you did mistake some wherecodercat

3 Answers

10
votes

It seems this was introduced into iOS 7.1 and affects non-retina iPads running iPhone applications with retina graphics.

No solution for developers. I think Apple will have to patch this one...

Problem devices: iPad 2 iPad Mini (non-retina).

Problem does not exist in iOS 7.0 and status bar issues can be fixed for 7.0 with the other solutions posted.

Update for September 2014 - iOS 8:

This bug is fixed for iOS 8!!!!!

0
votes

Add this code.

- (BOOL)prefersStatusBarHidden{
return YES;}
-1
votes

Add an property in YourViewController as

@property BOOL statusBarHidden;

and then in ViewDidLoad add the following lines of code

    [self prefersStatusBarHidden];
    [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];
    self.statusBarHidden = YES;

Then add an method in YourViewController

- (BOOL)prefersStatusBarHidden{
return YES;}

and also don't forgot to add the #import <UIKit/UIKit.h> in your code it works great for IOS6.1 & 7.0 :)