Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

Commit

Permalink
Use inherited statusbar height (rather than hardcoded 20px) so height…
Browse files Browse the repository at this point in the history
… on correct on iPhone X family
  • Loading branch information
Dave Alden committed Feb 8, 2019
1 parent df1579b commit fb6c0cd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ios/CDVInAppBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ Licensed to the Apache Software Foundation (ASF) under one
#define IAB_BRIDGE_NAME @"cordova_iab"

#define TOOLBAR_HEIGHT 44.0
#define STATUSBAR_HEIGHT 20.0
#define LOCATIONBAR_HEIGHT 21.0
#define FOOTER_HEIGHT ((TOOLBAR_HEIGHT) + (LOCATIONBAR_HEIGHT))

Expand Down Expand Up @@ -962,8 +961,12 @@ - (void)viewWillAppear:(BOOL)animated
if (IsAtLeastiOSVersion(@"7.0") && !viewRenderedAtLeastOnce) {
viewRenderedAtLeastOnce = TRUE;
CGRect viewBounds = [self.webView bounds];
viewBounds.origin.y = STATUSBAR_HEIGHT;
viewBounds.size.height = viewBounds.size.height - STATUSBAR_HEIGHT;

CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
CGFloat statusBarHeight = statusBarFrame.size.height;

viewBounds.origin.y = statusBarHeight;
viewBounds.size.height = viewBounds.size.height - statusBarHeight;
self.webView.frame = viewBounds;
[[UIApplication sharedApplication] setStatusBarStyle:[self preferredStatusBarStyle]];
}
Expand Down Expand Up @@ -1220,9 +1223,6 @@ - (void) dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))com
- (void) viewDidLoad {

CGRect statusBarFrame = [self invertFrameIfNeeded:[UIApplication sharedApplication].statusBarFrame];
statusBarFrame.size.height = STATUSBAR_HEIGHT;
// simplified from: http://stackoverflow.com/a/25669695/219684

UIToolbar* bgToolbar = [[UIToolbar alloc] initWithFrame:statusBarFrame];
bgToolbar.barStyle = UIBarStyleDefault;
[bgToolbar setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
Expand Down

0 comments on commit fb6c0cd

Please sign in to comment.