mirror of
https://github.com/apache/cordova-plugin-statusbar.git
synced 2025-01-31 10:35:41 +08:00
Handle resize issues
This commit is contained in:
parent
b7079e3b3b
commit
41a77f532b
@ -105,8 +105,8 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
|||||||
//add a small delay ( 0.1 seconds ) or statusbar size will be wrong
|
//add a small delay ( 0.1 seconds ) or statusbar size will be wrong
|
||||||
__weak CDVStatusBar* weakSelf = self;
|
__weak CDVStatusBar* weakSelf = self;
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||||
[weakSelf resizeStatusBarBackgroundView];
|
|
||||||
[weakSelf resizeWebView];
|
[weakSelf resizeWebView];
|
||||||
|
[weakSelf resizeStatusBarBackgroundView];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,6 +423,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
|||||||
|
|
||||||
-(void)resizeStatusBarBackgroundView {
|
-(void)resizeStatusBarBackgroundView {
|
||||||
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
|
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
|
||||||
|
statusBarFrame.size.height = self.webView.frame.origin.y; // Set the height to the current webView origin in case it has been changed after resizing
|
||||||
CGRect sbBgFrame = _statusBarBackgroundView.frame;
|
CGRect sbBgFrame = _statusBarBackgroundView.frame;
|
||||||
sbBgFrame.size = statusBarFrame.size;
|
sbBgFrame.size = statusBarFrame.size;
|
||||||
_statusBarBackgroundView.frame = sbBgFrame;
|
_statusBarBackgroundView.frame = sbBgFrame;
|
||||||
@ -445,7 +446,7 @@ static const void *kStatusBarStyle = &kStatusBarStyle;
|
|||||||
float safeAreaTop = self.webView.safeAreaInsets.top;
|
float safeAreaTop = self.webView.safeAreaInsets.top;
|
||||||
|
|
||||||
if (!self.statusBarOverlaysWebView) {
|
if (!self.statusBarOverlaysWebView) {
|
||||||
frame.origin.y = height >= safeAreaTop ? height : safeAreaTop;
|
frame.origin.y = height >= safeAreaTop || height == 0 ? height : safeAreaTop;
|
||||||
} else {
|
} else {
|
||||||
if (height >= safeAreaTop && safeAreaTop >0) {
|
if (height >= safeAreaTop && safeAreaTop >0) {
|
||||||
// Sometimes when in-call/recording/hotspot larger status bar is present, the safeAreaTop is 40 but we want frame.origin.y to be 20
|
// Sometimes when in-call/recording/hotspot larger status bar is present, the safeAreaTop is 40 but we want frame.origin.y to be 20
|
||||||
|
Loading…
Reference in New Issue
Block a user