Skip to content

Commit

Permalink
[TIMOB-25765]: iOS 11 Scrollview layout error when set window with in…
Browse files Browse the repository at this point in the history
…cludeOpaqueBars and extendEdges (#9866)
  • Loading branch information
vijaysingh-axway authored and ewieberappc committed Feb 22, 2018
1 parent 54ab479 commit ecf222f
Showing 1 changed file with 22 additions and 0 deletions.
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

0 comments on commit ecf222f

Please sign in to comment.