2019-06-10

2019-06-10  本文已影响0人  奋斗的遗忘人

解决UITableView的group类型听不或者section留有间隙的问题:

//设置tableView的headerView
self.myTableView.tableHeaderView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, CGFLOAT_MIN)];

//解决sectionHeader顶部留白
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0.001;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    return [UIView new];
}

不加这些代码前:


前.png
加上之后: 后.png
上一篇 下一篇

猜你喜欢

热点阅读