Reputation: 11
I am using the Cordova StatusBar plugin: https://github.com/apache/cordova-plugin-statusbar It works well except when I initially hide the status on iOS.
What I try to do:
For that, I modify my plist as specified in the plugin's README. It works fine, the status bar is hidden when splashscreen is launched.
However, when I use StatusBar.show()
, it doesn't work. The status bar stays hidden. (I use StatusBar.show()
on deviceready
event.)
Upvotes: 0
Views: 784
Reputation: 11
I've finally resolved my problem. I post here what I've found if anyone wants to achieve the same thing I did.
First note that I use PhoneGap Build, so this solution applies to that service.
To hide status bar during the time the splashscreen is visible, you need to modify the app's plist file (as stated here: https://github.com/apache/cordova-plugin-statusbar#hiding-at-startup).
To achieve on that on PhoneGap Build, you have to add the follwing lines to your config.xml file:
<gap:config-file platform="ios" parent="UIStatusBarHidden"><true/></gap:config-file>
<gap:config-file platform="ios" parent="UIViewControllerBasedStatusBarAppearance"><false/></gap:config-file>
Then you'll need to voluntarily show the status bar. So when hiding the splashscreen, use StatusBar.show();.
setTimeout(function() {
navigator.splashscreen.hide();
StatusBar.show(); // Status bar is initially hidden, we need to show it when splashscreen disappears
}, 2000);
Upvotes: 0