Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-25765]: iOS 11 Scrollview layout error when set window with includeOpaqueBars and extendEdges #9866

Merged
merged 3 commits into from
Feb 22, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions iphone/Classes/TiUIScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "TiUIScrollView.h"
#import "TiUIScrollViewProxy.h"
#import "TiUtils.h"
#import "TiWindowProxy.h"

@implementation TiUIScrollViewImpl

Expand Down Expand Up @@ -140,9 +141,30 @@ - (TiUIScrollViewImpl *)scrollView
[self addSubview:scrollView];
#endif
}
if ([TiUtils isIOS11OrGreater]) {
[self adjustScrollViewInsets];
}
return scrollView;
}

- (void)adjustScrollViewInsets
{
#if IS_XCODE_9
id viewProxy = self.proxy;
while (viewProxy && ![viewProxy isKindOfClass:[TiWindowProxy class]]) {
viewProxy = [viewProxy parent];
}
if (viewProxy != nil) {
id autoAdjust = [(TiProxy *)viewProxy valueForUndefinedKey:@"autoAdjustScrollViewInsets"];
if ([TiUtils boolValue:autoAdjust def:NO]) {
[scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentAlways];
} else {
[scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
}
}
#endif
}

- (id)accessibilityElement
{
return [self scrollView];
Expand Down