Search code examples
ioscordovastatusbarinappbrowser

iOS Status Bar pushing InAppBrowser down


enter image description hereThis is the environment:

- iOS 11
- Cordova 8.0.0
- cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
- cordova-plugin-statusbar 2.4.2 "StatusBar"

The status bar pushes the InAppBrowser down and hides 20px of the displayed webpage. This was working fine in iOS 10.


Solution

  • After days of research I found the answer on this page:

    CB-14024 Take into account statusbar height when toolbar is enabled

    Basically this is the fix: Look for rePositionViews in CDVInAppBrowser.m and replace accordingly.

    - (void) rePositionViews {
       if ((_browserOptions.toolbar) && ([_browserOptions.toolbarposition isEqualToString:kInAppBrowserToolbarBarPositionTop])) {
          [self.webView setFrame:CGRectMake(self.webView.frame.origin.x, TOOLBAR_HEIGHT + [self getStatusBarOffset], self.webView.frame.size.width, self.webView.frame.size.height - [self getStatusBarOffset])];
          [self.toolbar setFrame:CGRectMake(self.toolbar.frame.origin.x, [self getStatusBarOffset], self.toolbar.frame.size.width, self.toolbar.frame.size.height)];
       }
    }