美文网首页
UITableViewStyleGroup设置头部高度的方法

UITableViewStyleGroup设置头部高度的方法

作者: 213dfddbef5e | 来源:发表于2017-03-01 17:07 被阅读202次
  1. 设置标头的高度为特小值(不能为0,为0的话苹果会取默认值就无法消除头部间距了)
UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 0.001)];
view.backgroundColor = [UIColor redColor];
self.tableView.tableHeaderView = view;
  1. 写代理方法(中间的留白其实是段尾的高度,代理的作用是设置段尾的高度,返回值也不能为 0)
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 0.01f;
}

相关文章

网友评论

      本文标题:UITableViewStyleGroup设置头部高度的方法

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