網上的資料很多就不贅述,本文純粹是做個筆記方便日後開發查詢。
iOS_新版iOS11 UITbleView適配的一些問題及解決方法
// tableView 偏移20/64適配
if (@available(iOS 11.0,
*)) {
self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;//UIScrollView也適用
}else {
self.automaticallyAdjustsScrollViewInsets = NO;
}
// tableView 如果是Gruop類型的話,section之間的間距變寬,執行返回高度的同時還需要執行return UIView的代理
- (CGFloat)tableView:(UITableView *)tableView
heightForHeaderInSection:(NSInteger)section{
return 10;
}
- (CGFloat)tableView:(UITableView *)tableView
heightForFooterInSection:(NSInteger)section{
return 0.1;
}
- (UIView *)tableView:(UITableView *)tableView
viewForHeaderInSection:(NSInteger)section {
return [[UIView alloc] init];
}
- (UIView *)tableView:(UITableView *)tableView
viewForFooterInSection:(NSInteger)section {
return [[UIView alloc] init];
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.