iOS UITableView在 UITableViewStyleGrouped样式下第一组组头变高问题

UITableView在 UITableViewStyleGrouped样式下第一组组头莫名变高,针对这个问题有以下两种方式处理

1、直接设置contentInset,不推荐这个方法,虽然能够解决问题

self.homeTableView.contentInset = UIEdgeInsetsMake(-36, 0, 0, 0);

2、通过UITableViewDelegate代理方法实现,不要试图设置为0,会不起作用

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    return nil;
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0.001;
    
}
原文地址:https://www.cnblogs.com/lijianyi/p/11492558.html