Ionic iPhone X statusbar white bar with updated statusbar plugin

时间:2018-01-23 19:25:44

标签: cordova ionic-framework cordova-plugins ionic3

I've been trying for a while now to get rid of this white bar on the top of my app when running on iPhone X. I've read in many places that updating from v2.2.0 of the cordova-plugin-statusbar to v2.3.0+ would get rid of this. After updating nothing changed, the white bar is still there.

What can I do to get rid of this? I don't know what else I can try.

Any help would be great, thanks!

enter image description here

1 个答案:

答案 0 :(得分:1)

首先更新index.html中的视口元标记,以添加viewport-fit=cover字段。

<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">

app.component.ts中更改状态栏的颜色。

import { StatusBar } from "@ionic-native/status-bar";

export class MyApp {

  constructor(private statusBar: StatusBar) {
    platform.ready().then(() => {
      statusBar.overlaysWebView(false);
      statusBar.backgroundColorByHexString('#000');
      statusBar.styleBlackOpaque();
    }
  });
}

或者您可以使用statusBar.hide();

完全隐藏它

inbound impersonation