在 iOS11時(shí),當(dāng)我們?cè)谑褂?tableView 進(jìn)行分組時(shí)( style:UITableViewStyleGrouped)會(huì)出現(xiàn) cell 組間距被拉伸的情況,如下圖:

左為 iOS 11之前,右為 iOS 11之后
決絕方案: 添加一下兩個(gè)代理方法;
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
return [[UIView alloc] init];
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
return [[UIView alloc] init];
}