iOS 11上執行tableView向下偏移64pt或者20pt
阿新 • • 發佈:2019-01-04
1、在iOS 11上執行tableView向下偏移64pt或者20pt,因為iOS 11廢棄了automaticallyAdjustsScrollViewInsets,而是給UIScrollView增加了contentInsetAdjustmentBehavior屬性。避免這個坑的方法是要判斷
1 2 3 4 5 |
if
(@available(iOS
11.0
, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
else
{
self.automaticallyAdjustsScrollViewInsets = NO; }
|
2、tableView的sectionHeader、sectionFooter高度與設定不符,因為tableView的estimatedRowHeight、estimatedSectionHeaderHeight、 estimatedSectionFooterHeight三個高度估算屬性由預設的0變成了UITableViewAutomaticDimension。最簡單的方法就是直接設定為0。