如何在iOS上移除Ionic Webview顶部的空间

How to remove the space at the top of Ionic Webview on iOS?

本文关键字:Webview Ionic 顶部 空间 iOS      更新时间:2023-09-26

这是我第一次使用Ionic进行开发。

我试图在我的应用程序中删除状态栏。现在,iPad应用程序的状态栏被删除了。然而,在我的图标视图的顶部仍然有一个空间(我认为它的大小和状态栏一样)。我已经使用这段代码设置了Javascript文件来隐藏状态栏,但是它不起作用。

ionic.Platform.ready(function() {
// hide the status bar using the StatusBar plugin
StatusBar.hide();
// ionic.platform.fullScreen();
});

我该如何解决这个问题,还是我做错了什么?谢谢你。

这是在web浏览器和iOS模拟器之间的图像比较

  • Web浏览器http://i58.tinypic.com/2iuxmk6.png

  • iOShttp://i62.tinypic.com/eqxpfs.png

我也遇到了同样的问题。我使用:

ionic.Platform.ready(function() {
  //hide the status bar using the StatusBar plugin
  if(window.StatusBar) {
    // org.apache.cordova.statusbar required
    StatusBar.hide();
    ionic.Platform.fullScreen();
  }
});

ionic.Platform.fullScreen ();是我项目里的东西。

您是否安装了这样的状态栏插件:

$ cordova plugin add org.apache.cordova.statusbar

只有在此之后,您才能删除状态栏:

angular.module('myApp', ['ionic'])
.controller('MyCtrl', function($scope) {
  ionic.Platform.ready(function() {
    // hide the status bar using the StatusBar plugin
    StatusBar.hide();
  });
});

也许他的解决方法可能会有所帮助…this.statusBar.overlaysWebView(true);