前言
因为页面用了headerView和cell来实现效果,需要让header和cell有连续的直线连接的,所以tableView使用了UITableViewStyleGrouped类型,但是尾视图出现了一段空缺。如图:
代码实现
第一次尝试,失败
修改组footerView高度
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 0;
}
结果:没有变化,还是有空隙
第二次尝试,失败
修改返回的footerView,使其为nil
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
return nil;
}
结果:没有变化,还是有空隙
第三次尝试,成功
修改高度同时修改footerView为nil
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 0;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
return nil;
}
结果修改成功,效果如图: