Is it possible to get rid of the status bar in iOS7 when using Phonegap Build 3.1? I can remove the status bar when building locally in Xcode, but as soon as I try Phonegap Buil
Simply install the status bar plugin (I'm using Cordova 5.x):
cordova plugin add cordova-plugin-statusbar@1.0.1
The in your code just reference its global variable and use .hide():
StatusBar.hide()
Add this function into MainViewController.m file:
//fix not hide status on ios7
- (BOOL)prefersStatusBarHidden
{
return YES;
}
As of Phonegap 3 you can now customize plist files via config.xml.
Code:
<gap:config-file platform="ios" parent="UIViewControllerBasedStatusBarAppearance" overwrite="true">
<false/>
</gap:config-file>
I've answered this for removing the Status bar altogether in your previous question
The essential part:
I got this to work beautifully in Cordova 3.6 + iOS 7.1. And considering that iOS 7 and 8 each have 50% of market share this solution should be enough.
Plugin I'm using: org.apache.cordova.statusbar
Instead of using StatusBar.hide()
I used:
var hideSb = function(){
// StatusBar.hide;
cordova.exec(null, null, 'StatusBar', 'hide', ['Ehi', 'You']);
};
I'm using the following in config.xml which completely removes the status bar, tested on iOS 7.0.3 & 7.0.4, Phonegap version 3.0.0 if that helps.
<preference name="fullscreen" value="true" />
Usually, you would edit the info.plist and add this key:
<key>UIViewControllerBasedStatusBarAppearance</key><false/>
But as you can't do this on build, you'll have to add a plugin:
https://github.com/phonegap-build/StatusBarPlugin/blob/master/README.md
And then:
StatusBar.hide();