Содержимое панели состояния iOS

У меня есть приложение для телефонных разговоров, оно отлично работает на Android и Windows. Но для iOS я столкнулся с проблемой, поскольку содержимое строки состояния и содержимое страницы смешаны, поэтому я не могу нажать кнопку "Назад", представленную в заголовке. Может ли кто-нибудь помочь мне в этом?..

Это мой файл config.xml

   <?xml version="1.0" encoding="UTF-8"?>
<widget xmlns   = "http://www.w3.org/ns/widgets"
        xmlns:gap   = "http://phonegap.com/ns/1.0"

        id        = "io.example.com"
        version     = "1.0.2">
    <name>MyAPP</name>

    <description>

    </description>

    <author  email="[email protected]">
        Rakesh
    </author>

    <access origin="*"/>


    <content src="index.html" />


    <preference name="target-device" value="universal" />   <!-- all: possible values handset, tablet, or universal -->
    <!-- <preference name="fullscreen" value="true" />  -->          <!-- all: hides the status bar at the top of the screen -->
    <preference name="webviewbounce" value="false" />        <!-- ios: control whether the screen 'bounces' when scrolled beyond the top -->
    <preference name="ios-statusbarstyle" value="black-opaque" />   <!-- ios: black-translucent will appear black because the PhoneGap webview doesn't go beneath the status bar -->
    <preference name="auto-hide-splash-screen"    value="true" />           <!-- ios: if set to false, the splash screen must be hidden using a JavaScript API -->
    <preference name="android-minSdkVersion"      value="7" />              <!-- android: MIN SDK version supported on the target device. MAX version is blank by default. -->
    <preference name="phonegap-version" value="3.7.0" />
    <icon src="icon.png" />

    <icon src="icon-57.png"            gap:platform="ios"        width="57" height="57" />
    <icon src="icon-72.png"            gap:platform="ios"        width="72" height="72" />
    <icon src="icon-57-2x.png"         gap:platform="ios"        width="114" height="114" />
    <icon src="icon-72-2x.png"         gap:platform="ios"        width="144" height="144" />
    <icon src="icon-120.png"           gap:platform="ios"        width="120" height="120" />
    <icon src="icon-76.png"            gap:platform="ios"        width="76" height="76" />
    <icon src="icon-76-2x.png"         gap:platform="ios"        width="152" height="152" />

    <gap:plugin name="com.phonegap.plugin.statusbar" />
    <gap:plugin name="org.apache.cordova.device" />
    <gap:plugin name="org.apache.cordova.dialogs" />
    <gap:plugin name="org.apache.cordova.camera" />
    <gap:splash src="SplashScreenImage.jpg" gap:platform="winphone" />
    <gap:splash src="splash.png" />
    <gap:splash src="screen-iphone-portrait.png"         gap:platform="ios"     width="320" height="480" />
    <gap:splash src="screen-iphone-portrait-2x.png"      gap:platform="ios"     width="640" height="960" />
    <gap:splash src="screen-iphone-portrait-568h-2x.png" gap:platform="ios"     width="640" height="1136" />
    <gap:splash src="screen-ipad-portrait.png"           gap:platform="ios"     width="768" height="1024" />
    <gap:splash src="screen-ipad-landscape.png"          gap:platform="ios"     width="1024" height="768" />

    <gap:config-file platform="ios" parent="CFBundleShortVersionString">
    <string>100</string>
    </gap:config-file>

    <feature name="App">
      <param name="android-package" value="org.apache.cordova.App"/>
    </feature>
    <feature name="http://api.phonegap.com/1.0/network"/>

    <!-- Deprecated plugins element. Remove in 3.0 -->


</widget>

Ответы

Ответ 1

Добавьте эти строки в файл config.xml

<preference name="StatusBarOverlaysWebView" value="false" />
        <preference name="StatusBarBackgroundColor" value="#000000" />
        <preference name="StatusBarStyle" value="lightcontent" />
      <gap:plugin name="com.phonegap.plugin.statusbar" />

Ответ 2

Принятый ответ от sunil больше не уместен, плагин устарел.

Используйте в файле config.xml следующее:

<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#000000" />
<preference name="StatusBarStyle" value="lightcontent" />
<plugin spec="https://github.com/apache/cordova-plugin-statusbar.git" source="git" />

Ответ 3

Это можно сделать с помощью плагина statusbar. Все, что вам нужно, это установить плагин через командную строку phonegap plugin add https://github.com/apache/cordova-plugin-statusbar.git, а затем добавить StatusBar.hide(); событие onDeviceReady.

Ответ 4

Если вы хотите полностью скрыть StatusBar, вы можете добавить два ключа в ваш info.plist, которые являются логическими:

Status bar is initially hidden - YES

View controller-based status bar appearance - NO

Ответ 5

Для более подробного использования в codova 6+ теперь для большего количества решений @sunil мы должны использовать

cordova plugins add -save cordova-plugin-statusbar

Для подробного использования: https://www.npmjs.com/package/cordova-plugin-statusbar

Ответ 6

Применяется разрешение @sunil, но

Моя проблема заключалась в "политике безопасности контента" на iOS 10

Добавлена ​​ниже строка в index.html устранена проблема:

<meta http-equiv="Content-Security-Policy" content="default-src 'self' gap://ready file://* *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">