6

I added the https://github.com/apache/cordova-plugin-statusbar plugin. Now setting the

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

still does not work (false and true) and it is always overlaping in IOS 7. But setting

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

works normal and I am able to use different status bar colors. So for me it looks like the plugin is basically working. Has someone a idear what I do wrong?

Thx! cheers

PowPi
  • 164
  • 1
  • 1
  • 10

4 Answers4

14

Try to add following lines in config.xml:

<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#165769" /> <!--Your color value will go here-->
<preference name="StatusBarStyle" value="lightcontent" />
Dhruv
  • 1,801
  • 1
  • 15
  • 27
  • 1
    I managed to get it work with recreating an other cordova projekt and re adding my files. I also added the color value and so acutally I'm not 100 % sure what solved it but it works. So i will mark it as the right answer. :) – PowPi Feb 03 '16 at 10:32
  • 1
    I had the same problem. I was missing "StatusBarStyle" preference and no matter what "StatusBarOverlaysWebView" I was setting, it would always overlap. Setting the three properties it started to work. – Alvaro Vazquez Oct 13 '16 at 08:04
  • 1
    I've been doing all of this and it still has a transparent background with White Letters, not what I wanted. – Mark Hill Feb 21 '17 at 19:29
  • @MarkHill i m having the same issue.. were u able to solve it? – ziaulain Mar 19 '18 at 09:46
  • 1
    You may need to also run 'cordova prepare ios', clean xcode build folder, build again and run. – FelipeDrumond May 16 '20 at 06:38
  • 1
    Setting "StatusBarOverlaysWebView" fixed several problems with Cordova and Status Bar rendering. It also fixed an issue with white bars on the bottom of larger iPhone screens. – Rastilin Apr 14 '21 at 12:20
7

I found out the reason, you should add plugin js in your html.

First, you should include "cordova.js" in your html.

<script type="text/javascript" src="cordova.js"></script>

Second, you may found platform_www under folder ./platforms/ios/platform_www. Please copy all the files into your www folder.

Then, you can find, it works.

杨文锦
  • 71
  • 2
  • 1
    I guess you need always to add cordova.js to the index otherwise it will not work. And as far as I know, platform/ios/platform_www is build on cordova build ios / cordova run ios. So normally the platform_www files should be the one in the www root. – PowPi Feb 03 '16 at 10:31
  • 1
    This is what fixed it for me – Jonathan Apodaca Sep 26 '16 at 15:26
2

I almost broken down and tried Ric's answer, which I feared would be the only way to fix it. But after a few days and one more try, I finally got it to work like so:

# uninstall app from ipad
# close xcode
cordova plugin remove cordova-plugin-statusbar
cordova prepare
cordova clean ios
# open up xcode
# clean project in xcode
# run project from xcode onto ipad
# stop the app
# close xcode
cordova plugin add cordova-plugin-statusbar
# add preferences to config.xml
cordova prepare
cordova clean ios
# open up xcode
# clean project in xcode
# run project from xcode onto ipad

Don't ask me why this worked, I've used this plugin dozens of times without issue, but for some reason it got all confused on this project, but the above steps were able to resolve it.

tyler.frankenstein
  • 2,314
  • 1
  • 23
  • 36
1

I have done everything that has been suggested. Cordova just did not reflect my settings. Finally I took the drastic step suggested also suggested elsewhere-

remove ios project- cordova platform rm ios --save

Re-add the ios project- cordova platform add ios --save

Be forewarned, this causes Xcode 8 to get very very excited about missing a team signing specification. So you have to go to the Xcode 8 Project Editor: TARGETS your-app, Signing- and reselect your Team. Then it will all come together and work.

Ric
  • 796
  • 12
  • 28