iOS11 UITbleView適配的一些問題及解決方法

就是項目中發(fā)現(xiàn)的問題而已

// tableView 偏移20/64適配

if(@available(iOS11.0, *)) {

self.tableView.contentInsetAdjustmentBehavior=UIScrollViewContentInsetAdjustmentNever;//UIScrollView也適用

}else{

self.automaticallyAdjustsScrollViewInsets=NO;

}

// tableView 如果是Gruop類型的話,section之間的間距變寬,執(zhí)行返回高度的同時還需要執(zhí)行return UIView的代理

- (CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section{

return10;

}

- (CGFloat)tableView:(UITableView*)tableView heightForFooterInSection:(NSInteger)section{

return0.1;

}

- (UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section {

return[[UIViewalloc]init];

}

- (UIView*)tableView:(UITableView*)tableView viewForFooterInSection:(NSInteger)section {

return[[UIViewalloc]init];

}

?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內(nèi)容