iOS status Bar in phonegap
Posted By : Akhil Dhiman | 22-Jan-2015
While running PhoneGap app on iOS I found out that the status bar is creating issue because now my app was running in full screen and status bar is floating on the app. But now cordova giving support to add status bar in iOS Applications.
Plugin to use:
I used plugin named Cordova StatusBar Plugin you can use the following link to check the plugin.
http://plugins.cordova.io/#/package/org.apache.cordova.statusbar
To add this plugin in your project follow the following procedure.
Using terminal go in your project directory, from inside your cordova project you have to enter the following command.
cordova plugin add org.apache.cordova.statusbar
Methods used to apply statusbar
This plugin gives us a global object name StatusBar
we need to call the statusbar code in deviceready event
Below are the methods used to customized status bar
StatusBar.overlaysWebView
StatusBar.styleDefault
StatusBar.backgroundColorByName
StatusBar.backgroundColorByHexString
StatusBar.hide
StatusBar.show
- StatusBar.overlaysWebView
StatusBar.overlaysWebView(false);
- StatusBar.styleDefault
StatusBar.styleDefault();
- StatusBar.backgroundColorByName
StatusBar.backgroundColorByName();
- StatusBar.backgroundColorByName
StatusBar.backgroundColorByName("#CC99FF");
- StatusBar.hide
StatusBar.hide();
- StatusBar.show
StatusBar.show();
Apart from all this plugin gives you a global method to check weather status bar is visible or not and you can perform any operations.
if(StatusBar.isVisible){
}
Thanks
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Akhil Dhiman
Akhil is an iPhone and Android application developer with experience in PhoneGap and Swift(Native iOS). Akhil has good experience working with JavaScript, jQuery and Underscore as well.