简体   繁体   中英

Cordova statusbar black on black on iOS

I have a Cordova iPhone app, which uses the statusbar plugin. The status bar's background is set to black, and the text used to be white. But since upgrading the plugin from version 0.1.3 to 0.1.8, the text is now black.

Is it possible to get the old behavior back, or to specify the text color?

Information for debugging:

Using Cordova 3.6.3 and statusbar plugin 0.1.8.

I see this behavior on iOS 8 and 7.

The iOS project has the following configs:

<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#000000" />

I'm using Xcode 6.0.1, with iOS SDK 8.0. In Xcode, "Hide status bar" is unchecked, and "Status Bar Style" is set to Default (but the same thing happens when I set it to Light).

The JavaScript StatusBar.isVisible returns true, and if I call StatusBar.backgroundColorByHexString("#FFF") , the background lightens, so the black text becomes visible.

This wasn't clear from the documentation, but there's a StatusBarStyle preference, and even if it's not present, it seems to override "Status Bar Style" from Xcode's project settings. So setting this in Cordova's config.xml fixed the problem:

<preference name="StatusBarStyle" value="lightcontent" />

I stumbled upon this tool that let's you toggle the setting for the status bar plugin and copy and paste in the preferences to config.xml. It's just what I needed! Hopefully helps others:

http://hollyschinsky.github.io/phonegap-workshop/develop/status-bar-handling.html 在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM