Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic ion-view header behind ios status bar

How do I avoid ionic header from getting behind ios status bar like this?

enter image description here

I created the header with following code:

<ion-view title="{{title}}" hide-nav-bar="false">
like image 568
Azizi Musa Avatar asked Aug 13 '15 08:08

Azizi Musa


1 Answers

From: http://www.sitepoint.com/5-ionic-app-development-tips-tricks/

Ionic has specific classes to deal with this – platform-ios and platform-cordova. Ionic’s pre-built elements target those classes and add in 20px top margin to the buttons in your header to make up for these situations. To get my own custom elements to do the same, I follow the same pattern. For my .search-bar above, I add a margin if we’ve got a .platform-ios.platform-cordova:not(.fullscreen) body class. Example:

.platform-ios.platform-cordova:not(.fullscreen) .search-bar {
     margin-top: 20px;
}

This should be the correct answer.

like image 145
Chocksmith Avatar answered Sep 22 '22 23:09

Chocksmith