美文网首页
UITableView设置sectionHeaderHeight

UITableView设置sectionHeaderHeight

作者: 月沉眠love | 来源:发表于2019-07-11 15:00 被阅读0次

设置高度第一个sectionheader高度总是不对

   _tableView.sectionHeaderHeight = 0.01;
    _tableView.sectionFooterHeight =5;

代理方法也不行

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 5;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.01;
}

解决方法:

_tableView.tableHeaderView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];//必须设置
_tableView.sectionHeaderHeight = 0;
 _tableView.sectionFooterHeight = 5;

相关文章

网友评论

      本文标题:UITableView设置sectionHeaderHeight

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