iOS 10.3.3, there is a problem with the layout of tableView, as shown in the following figure, tableView has a sudden offset.
the code is as follows:
- (void)viewWillLayoutSubviews{
self.tableView.translatesAutoresizingMaskIntoConstraints = NO;
[super viewWillLayoutSubviews];
[self.tableView.bottomAnchor constraintEqualToAnchor: self.view.bottomAnchor constant: -52].active = YES;
[self.tableView.leadingAnchor constraintEqualToAnchor: self.view.leadingAnchor].active = YES;
[self.tableView.trailingAnchor constraintEqualToAnchor: self.view.trailingAnchor].active = YES;
[self.tableView.topAnchor constraintEqualToAnchor: self.view.topAnchor constant: 75].active = YES;
}
self.automaticallyAdjustsScrollViewInsets
is set and does not work.
- (void)viewDidLoad {
[super viewDidLoad];
if (@available(iOS 11.0, *)) {
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
} else {
self.automaticallyAdjustsScrollViewInsets = NO;
}
}
in iOS 11.4, the layout is normal.
how to solve this problem?