之前的estimatedSection******Height默認爲0,現在不爲0了,直接寫第一部分代碼也可以,或者不設置estimatedSection,把代碼2兩個代理補上也行,看自己選擇,本質原因就是因爲默認值問題,這兩種方式都可以解決這個默認值問題
代碼1
if (@available(iOS 11.0, *)) {
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
// est和代理 可選1個
self.tableView.estimatedSectionFooterHeight = 0;
self.tableView.estimatedSectionHeaderHeight = 0;
} else {
self.automaticallyAdjustsScrollViewInsets = NO;
}
代碼2
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
return nil;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
return nil;
}
cell高度出現高度重合問題
self.tableView.estimatedRowHeight = 0;
default is UITableViewAutomaticDimension, set to 0 to disable