2017-03-22 54 views
0

我正在研究ionic v1中的sidemenu應用程序。在瀏覽器中一切正常。但是,當我在設備中安裝應用程序時,標題欄出現在頂部有一些填充。這會在狀態欄和標題欄之間顯示一個空格。我嘗試了所有可能的方式,但無法解決它。下面是該問題的截圖。iOS設備中的Ionic標題欄頂部填充問題

enter image description here

我安裝狀態欄插件,並更新config.xml中的優先級。

這裏是我的iOS

config.xml中
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<widget id="com.iton.vbuzz" version="1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> 
<name>My App</name> 
<description> 
    My App V1.0 
</description> 
<content src="index.html"/> 
<access origin="*"/> 
<preference name="phonegap-version" value="cli-6.2.0" /> 
<preference name="webviewbounce" value="false"/> 
<preference name="UIWebViewBounce" value="false"/> 
<preference name="DisallowOverscroll" value="true"/> 
<preference name="android-minSdkVersion" value="16"/> 
<preference name="BackupWebStorage" value="none"/> 
<preference name="ShowSplashScreenSpinner" value="false" /> 
<preference name="FadeSplashScreen" value="true" /> 
<preference name="FadeSplashScreenDuration" value="1.0" /> 
<preference name="AllowInlineMediaPlayback" value="true" /> 
<preference name="ShowSplashScreenSpinner" value="false" /> 
<preference name="StatusBarOverlaysWebView" value="false" /> 
<preference name="StatusBarBackgroundColor" value="#D6D6D6"/> 
<preference name="StatusBarStyle" value="lightcontent" /> 
<preference name="orientation" value="portrait" /> 
<feature name="StatusBar"> 
<param name="ios-package" value="CDVStatusBar" onload="true"/> 
</feature> 
<preference name="target-device"    value="universal" /> 
<preference name="prerendered-icon"   value="true" /> 
<preference name="detect-data-types"   value="true" /> 
<preference name="exit-on-suspend"   value="false" /> 

<platform name="ios"> 
<splash src="resources/ios/splash/[email protected]~iphone.png" width="640" height="1136"/> 
<splash src="resources/ios/splash/Default-667h.png" width="750" height="1334"/> 
<splash src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" height="768"/> 
<splash src="resources/ios/splash/[email protected]~ipad.png" width="1536" height="2048"/> 
<splash src="resources/ios/splash/Default-Portrait~ipad.png" width="768" height="1024"/> 
<splash src="resources/ios/splash/[email protected]~iphone.png" width="640" height="960"/> 
<splash src="resources/ios/splash/Default~iphone.png" width="320" height="480"/> 
<splash src="resources/ios/splash/2048X1536-04.png" width="2048" height="1536" /> 
<splash src="resources/ios/splash/[email protected]~iphone.png" width="750" height="1334" /> 

<icon src="resources/ios/icon/icon.png" width="57" height="57"/> 
<icon src="resources/ios/icon/[email protected]" width="114" height="114"/> 
<icon src="resources/ios/icon/icon-40.png" width="40" height="40"/> 
<icon src="resources/ios/icon/[email protected]" width="80" height="80"/> 
<icon src="resources/ios/icon/icon-50.png" width="50" height="50"/> 
<icon src="resources/ios/icon/[email protected]" width="100" height="100"/> 
<icon src="resources/ios/icon/icon-60.png" width="60" height="60"/> 
<icon src="resources/ios/icon/[email protected]" width="120" height="120"/> 
<icon src="resources/ios/icon/[email protected]" width="180" height="180"/> 
<icon src="resources/ios/icon/icon-72.png" width="72" height="72"/> 
<icon src="resources/ios/icon/[email protected]" width="144" height="144"/> 
<icon src="resources/ios/icon/icon-76.png" width="76" height="76"/> 
<icon src="resources/ios/icon/[email protected]" width="152" height="152"/> 
<icon src="resources/ios/icon/icon-small.png" width="29" height="29"/> 
<icon src="resources/ios/icon/[email protected]" width="58" height="58"/> 
<icon src="resources/ios/icon/[email protected]" width="87" height="87"/> 
<config-file parent="UIStatusBarHidden" platform="ios" target="*-Info.plist"> 
    <false/> 
</config-file> 
<config-file parent="UIViewControllerBasedStatusBarAppearance" platform="ios" target="*-Info.plist"> 
    <true/> 
</config-file> 
</platform> 

<plugin spec="https://github.com/apache/cordova-plugin-console.git 
" name="org.apache.cordova.console" source="git" version="0.2.13" /> 


<plugin spec="https://github.com/apache/cordova-plugin-device.git" name="org.apache.cordova.device" source="git" version="0.3.0" /> 


<plugin spec="https://github.com/apache/cordova-plugin-splashscreen.git" name="cordova-plugin-splashscreen" source="git" version="4.0.1-dev" /> 


    <plugin spec="https://github.com/phonegap-build/StatusBarPlugin.git" name="com.phonegap.plugin.statusbar" source="git" version="1.1.0" /> 


    <plugin spec="https://github.com/apache/cordova-plugin-geolocation.git" name="cordova-plugin-geolocation" source="git" version="2.4.1-dev" /> 


    <plugin spec="https://github.com/apache/cordova-plugin-network-information.git" name="cordova-plugin-network-information" source="git" version="1.3.1-dev" /> 


    </widget> 

在我app.js我定義:

if (window.StatusBar) { 
    if (ionic.Platform.isAndroid()) { 
    StatusBar.backgroundColorByHexString("#608628"); 
} else { 
    StatusBar.styleLightContent(); 
} 
} 

請幫我理清這個問題。在此先感謝

+0

嗨,你是否設法解決這個問題? – noor

回答

0

您可以在index.html文件添加到viewport-fit=coverviewport元數據標籤,如下

<meta name="viewport" content="viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> 

參考:https://blog.ionicframework.com/ios-11-checklist/

正常工作與iOS的11.2爲好。