aliokan / cordova-plugin-admob

AdMob Phonegap Plugin for Android and iOS
MIT License
71 stars 43 forks source link

iOS 7 and status bar #13

Open alextrs opened 10 years ago

alextrs commented 10 years ago

Looks like there is an issue with the way this plugin moves and resizes webView. In iOS 7 status bar covers the top of main view. You can change this behaviour using this plugin 'com.phonegap.plugin.statusbar' (move webView down 20px), but this plugin after initialization moves webView back to top. f1a7945e-b853-11e3-8159-2158bead550a Looks like by changing the following code:

  // Move the webview to the top of the screen.
    webViewFrame.origin.y = 0; 
 ...
webViewFrame.size.height = superViewFrame.size.height - bannerViewFrame.size.height;

To:

  // Move the webview to the top of the screen.
    if ([[UIDevice currentDevice].systemVersion floatValue] >= 7)
      webViewFrame.origin.y = 20;
    else
      webViewFrame.origin.y = 0;
   ...
      webViewFrame.size.height = superViewFrame.size.height - webViewFrame.origin.y - bannerViewFrame.size.height;

Resolves the issue, but I'm not sure what else it can break.

dawez commented 10 years ago

HI tried the above patch in 2 separate plugins : org.apache.cordova.statusbar and com.phonegap.plugin.statusbar. Both times that I implemented that the behavior of the webview is not changing. When the Ad is shown the webview get and incorrect margin [like the toolbar would be ignored].

I am using in the js cordova code : StatusBar.overlaysWebView(false); to prevent a bug appearing in IOS7.

dezudas commented 9 years ago

I ma having the same issue, and not resolved using provided solution.