简体   繁体   中英

Cordova and iOS 8 : the statusbar is hidden

I'm updating my Cordova-based application for iOS 8. I notice an issue with the status bar.

The status bar is positioned correctly after the first launch. But if I close the application and open it again, the status bar dissappears, so I have a blank gap of 20px in the top of my app screen.

What I use in my code for the status bar is :

    if ( mobileOS == 'iOS' && Number( mobileOSver.charAt(0) ) >= 7 ) {
        document.getElementsByTagName('body')[0].className+=' fix-ios-7-statusbar';
    }  

The class fix-ios-7-statusbar simply adds a padding-top:20px to the header. This works in iOS 7 very well, but in iOS 8 I have an issue with the status bar that is hidden if I close the app.

Please help me.

I use the statusbar plugin. There were issues in iOS8 (see here ), but the latest git commit fixed those for me. Give it a try.

cordova plugin add https://github.com/apache/cordova-plugin-statusbar.git#5658e7548c813bf7d6102eea4eaa7726b727b18e

My config.xml has this:

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

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