iOS statusbar overlay phonegap

雨燕双飞 提交于 2019-12-08 07:20:58

问题


I'm developing iOS app with PhoneGap (Cordova) and my problem is that status bar is overlaying my webview/application:

I've added preferences in my config.xml file but these are not working:

<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#0ff000" />
<preference name="StatusBarStyle" value="default" />

How can i solve that?


回答1:


Installation Command for Status bar Plugin

cordova plugin add cordova-plugin-statusbar 

StatusBarOverlaysWebView (boolean, defaults to true). On iOS 7, make the statusbar overlay or not overlay the WebView at startup. Add this line in your config.xml

<preference name="StatusBarOverlaysWebView" value="false" />

Please read official documentation for better understanding




回答2:


Solved this way: With cordova-plugin-statusbar installed, added this line to config.xml:

<gap:plugin name="com.phonegap.plugin.statusbar" />

and then in index.html:

<script type="text/javascript">
        document.addEventListener("deviceready", onDeviceReady, false);

        function onDeviceReady(){
            StatusBar.overlaysWebView(false);
        }
</script>



回答3:


Check out Step 3: at the bottom of the page at this link...

https://ccoenraets.github.io/cordova-tutorial/handlebars-templates.html

It actually looks pretty identical to what you did, but also involves a node plugin for the status bar issue.

cordova plugin add cordova-plugin-statusbar 

Hopefully it helps.



来源:https://stackoverflow.com/questions/41186994/ios-statusbar-overlay-phonegap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!