Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/102.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Ionic 3应用程序的iOS状态栏字体颜色更改为白色_Ios_Ionic Framework_Ionic2_Ionic3 - Fatal编程技术网

将Ionic 3应用程序的iOS状态栏字体颜色更改为白色

将Ionic 3应用程序的iOS状态栏字体颜色更改为白色,ios,ionic-framework,ionic2,ionic3,Ios,Ionic Framework,Ionic2,Ionic3,my config.xml <preference name="StatusBarOverlaysWebView" value="true" /> <preference name="StatusBarStyle" value="lightcontent" /> 这没用 如果您没有用于状态栏的ng cordova插件。那么你可以这样做- .run(function($ionicPlatform) { $ionicPlatform.ready(function() {

my config.xml

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

这没用

如果您没有用于状态栏的ng cordova插件。那么你可以这样做-

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
})

也许你可以在你的平台上试试这个。ready()。然后(()=>方法

StatusBar.overlyswebview(false);

StatusBar.backgroundColorByHexString(“#00FFFF”);
我找到了解决方案。它对我很有用

  statusBar.overlaysWebView(true);
  statusBar.backgroundColorByHexString('#1f2933');

在我的例子中,我需要在IOS中更改状态栏背景颜色和内容颜色

首先,我需要安装插件。

ionic cordova plugin add cordova-plugin-statusbar
npm install --save @ionic-native/status-bar@4 // version 4 since ionic 3
然后在app.com.ts中

  constructor(statusBar: StatusBar, platform: Platform) {
      platform.ready().then(() => {

          statusBar.overlaysWebView(false);
          // overlaysWebView must set to false if you change the background color in iOS with ionic (hence I am using backgroundColorByHexString method )

          statusBar.backgroundColorByHexString('#c8102e');
          // used above hex color code to set the status bar background color 

          statusBar.styleLightContent();
          // above function  will change the status bar content (icon , text)

          statusBar.show();
          // finally shows the status bar
      });
  }
最后我得到了我需要的


ionic 1和styleDefault()的代码对我不起作用
ionic cordova plugin add cordova-plugin-statusbar
npm install --save @ionic-native/status-bar@4 // version 4 since ionic 3
  constructor(statusBar: StatusBar, platform: Platform) {
      platform.ready().then(() => {

          statusBar.overlaysWebView(false);
          // overlaysWebView must set to false if you change the background color in iOS with ionic (hence I am using backgroundColorByHexString method )

          statusBar.backgroundColorByHexString('#c8102e');
          // used above hex color code to set the status bar background color 

          statusBar.styleLightContent();
          // above function  will change the status bar content (icon , text)

          statusBar.show();
          // finally shows the status bar
      });
  }