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!
答案 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();