美文网首页
2019-06-10

2019-06-10

作者: 奋斗的遗忘人 | 来源:发表于2019-06-10 18:06 被阅读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

相关文章

网友评论

      本文标题:2019-06-10

      本文链接:https://www.haomeiwen.com/subject/mrdtfctx.html