From 13645b9f53a58ad5c0041247087f1f2864ef4c29 Mon Sep 17 00:00:00 2001 From: MrBullfinsh Date: Sun, 20 Oct 2019 12:16:48 +0200 Subject: [PATCH] fix(iOS): Delay resizeWebView on viewWillAppear for correct statusbar height (#157) --- src/ios/CDVStatusBar.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ios/CDVStatusBar.m b/src/ios/CDVStatusBar.m index c67f137..2011163 100644 --- a/src/ios/CDVStatusBar.m +++ b/src/ios/CDVStatusBar.m @@ -92,7 +92,11 @@ static const void *kStatusBarStyle = &kStatusBarStyle; -(void)cordovaViewWillAppear:(NSNotification*)notification { - [self resizeWebView]; + //add a small delay ( 0.1 seconds ) or statusbar size will be wrong + __weak CDVStatusBar* weakSelf = self; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ + [weakSelf resizeWebView]; + }); } -(void)statusBarDidChangeFrame:(NSNotification*)notification