UITableView设置sectionHeaderHeight

2019-07-11  本文已影响0人  月沉眠love

设置高度第一个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;
上一篇下一篇

猜你喜欢

热点阅读