In iOS 7.0, I hid the status bar in my apps by adding
<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
to the info.plist. I just updated my testing iPad to iOS 7.1, and the status bar is now back in all of my apps. How can I hide it in both 7.0 and 7.1?
Update: This is only happening in iPhone apps running on the iPad, I don't see this problem on the iPhone or in the simulator.
To completely hide it on the home screen, open up an app, such as Settings, and wait about three to four seconds. Press the home button again, and the status bar will be completely gone. The status bar will only be hidden on your home screen, so you'll still see it while using apps.
Common Step. Go to Your info. plist file. Add a key called “View controller-based status bar appearance” and set its value to NO.
A status bar appears along the upper edge of the screen and displays information about the device's current state, like the time, cellular carrier, and battery level.
In the view controllers in which you want the status bar hidden, add the following method
- (BOOL)preferStatusBarHidden {
return YES;
}
Then you can call
[self setNeedsStatusBarAppearanceUpdate];
which will fire the change to the status bar. This call can be done inside of an animation block which will animate the change.
Try adding the following
- (void)viewWillAppear:(BOOL)animated{
NSLog(@"View will appear");
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
}
- (void)viewWillDisappear:(BOOL)animated{
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
}
I can reproduce the problem with a single-view iPhone-only app running in iPhone-compatibility mode in the simulator. But only when selecting an iPad non-retina on iOS 7.1.
My findings:
I tried these keys in the .plist:
<key>UIStatusBarHidden</key>
<true/>
<key>UIStatusBarHidden~ipad</key>
<true/>
and
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIViewControllerBasedStatusBarAppearance~ipad</key>
<false/>
I also tried the ViewController based-solution as mentioned by @Irfan to no avail.
There also seems no way to detect if the statusbar is shown as [UIApplication sharedApplication].statusBarFrame returns {0, 0, 0, 0}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With