GitToTheHub commented on code in PR #1701:
URL: https://github.com/apache/cordova-ios/pull/1701#discussion_r3870825046
##########
CordovaLib/Classes/Public/CDVViewController.m:
##########
@@ -905,7 +910,11 @@ - (void)showSplashScreen:(BOOL)visible
- (void)showStatusBar:(BOOL)visible
{
#if !defined(TARGET_OS_VISION) || !TARGET_OS_VISION
- [self.statusBarBackground setAlpha:(visible ? 1 : 0)];
+ _statusBarHidden = !visible;
+
+ UIScrollView *scrollView = [self.webView
performSelector:@selector(scrollView)];
+ [self scrollViewDidChangeAdjustedContentInset:scrollView];
+
Review Comment:
Another thing could be to source out the code which sets
`self.statusBarBackground.hidden` in
`scrollViewDidChangeAdjustedContentInset:`, like:
```objc
- (BOOL)shouldStatusBarBeHidden
{
// Detect changes on viewport-fit:
// viewport-fit=cover causes the contentInsetAdjustmentBehavior to be
UIScrollViewContentInsetAdjustmentNever
//
// On Mac Catalyst, Cordova may manually constrain the web view below
the title bar.
// In that case automatic scroll-view inset adjustment is disabled, so
the synthetic
// status bar view should be hidden.
UIScrollView *scrollView = [self.webView
performSelector:@selector(scrollView)];
return scrollView.contentInsetAdjustmentBehavior ==
UIScrollViewContentInsetAdjustmentNever
}
This could be called than in `showStatusBar:` and
`scrollViewDidChangeAdjustedContentInset:`
##########
CordovaLib/Classes/Public/CDVViewController.m:
##########
@@ -905,7 +910,11 @@ - (void)showSplashScreen:(BOOL)visible
- (void)showStatusBar:(BOOL)visible
{
#if !defined(TARGET_OS_VISION) || !TARGET_OS_VISION
- [self.statusBarBackground setAlpha:(visible ? 1 : 0)];
+ _statusBarHidden = !visible;
+
+ UIScrollView *scrollView = [self.webView
performSelector:@selector(scrollView)];
+ [self scrollViewDidChangeAdjustedContentInset:scrollView];
+
Review Comment:
Another thing could be to source out the code which sets
`self.statusBarBackground.hidden` in
`scrollViewDidChangeAdjustedContentInset:`, like:
```objc
- (BOOL)shouldStatusBarBeHidden
{
// Detect changes on viewport-fit:
// viewport-fit=cover causes the contentInsetAdjustmentBehavior to be
UIScrollViewContentInsetAdjustmentNever
//
// On Mac Catalyst, Cordova may manually constrain the web view below
the title bar.
// In that case automatic scroll-view inset adjustment is disabled, so
the synthetic
// status bar view should be hidden.
UIScrollView *scrollView = [self.webView
performSelector:@selector(scrollView)];
return scrollView.contentInsetAdjustmentBehavior ==
UIScrollViewContentInsetAdjustmentNever
}
```
This could be called than in `showStatusBar:` and
`scrollViewDidChangeAdjustedContentInset:`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]