Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

It's my first time of my development with Ionic.

I have tried to remove the status bar in my application. Now, the status bar of the iPad Application was removed. However, there is still a space at the top of my Iconic view (which I think the size is as same as status bar). I have already set the Javascript file using this code for hiding the status bar, but it's not working.

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

How can I solve this problem or did I do something wrong? Thank you.

Here is the images comparing between on the web browser and iOS simulator

  • Web browser http://i58.tinypic.com/2iuxmk6.png

  • iOS http://i62.tinypic.com/eqxpfs.png

like image 996
heartmon Avatar asked Aug 20 '14 13:08

heartmon


People also ask

How do I hide the status bar in Ionic?

Hide and Show Status Bar in Ionic You can hide the status bar using the hide() method, vice versa; you can use the show() method to show the status bar.

Does Ionic work on iOS?

Because of this foundation in web technologies, Ionic can run anywhere the web runs — iOS, Android, browsers, PWAs, and more.

Does Ionic capacitor use Webview?

Yeah both Apache Cordova and Capacitor are based on a web-view however capacitors web-view is made in house by Ionic most likely a stripped down version webkit. So there may be a performance benefit for Capacitor as they'll be able to remove unnecessary features from the ios and android web-view.


1 Answers

I had the same problem. I used:

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();
  }
});

The ionic.Platform.fullScreen(); was the thing from my project. That removes the space at the top.

like image 90
Mark Robson Avatar answered Oct 12 '22 22:10

Mark Robson