Fix content insets.

pull/1/head
Matthew Chen 7 years ago committed by Michael Kirk
parent 5cecce9976
commit 0c453c8d57

@ -453,10 +453,21 @@ NSString *const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier";
self.tableView.dataSource = self;
self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
[self.tableView applyScrollViewInsetsFix];
[self.view addSubview:self.tableView];
[self.tableView autoPinEdgesToSuperviewEdges];
if ([self.tableView applyScrollViewInsetsFix]) {
// if applyScrollViewInsetsFix disables contentInsetAdjustmentBehavior,
// we need to pin to the top and bottom layout guides since UIKit
// won't adjust our content insets.
[self.tableView autoPinToTopLayoutGuideOfViewController:self withInset:0];
[self.tableView autoPinToBottomLayoutGuideOfViewController:self withInset:0];
[self.tableView autoPinWidthToSuperview];
// We don't need a top or bottom insets, since we pin to the top and bottom layout guides.
self.automaticallyAdjustsScrollViewInsets = NO;
} else {
[self.tableView autoPinEdgesToSuperviewEdges];
}
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kOWSTableCellIdentifier];

@ -134,7 +134,8 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value);
@interface UIScrollView (OWS)
- (void)applyScrollViewInsetsFix;
// Returns YES if contentInsetAdjustmentBehavior is disabled.
- (BOOL)applyScrollViewInsetsFix;
@end

@ -519,7 +519,7 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
@implementation UIScrollView (OWS)
- (void)applyScrollViewInsetsFix
- (BOOL)applyScrollViewInsetsFix
{
// Fix a bug that only affects iOS 11.0.x and 11.1.x.
// The symptom is a fix weird animation that happens when using the interactive pop gesture.
@ -528,7 +528,9 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
#pragma clang diagnostic ignored "-Wpartial-availability"
self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
#pragma clang diagnostic pop
return YES;
}
return NO;
}
@end

Loading…
Cancel
Save