iOS tableview group时头尾视图间隔大小

解决:

一,当使用tableview的格式为group时

1.先设置

   tableview.sectionHeaderHeight = 0.00001;

     tableview.sectionFooterHeight = 0.000001;

2.在代理方法里写需要的高度即可

  -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section

  {

      return 5;

  }

  - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

  {

    return 5;    

  }

3.如果要单独设置头视图 或者尾视图 可以如下写法

//只设置尾视图 不需要头视图

  -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section

  {

      return 5;

  }

  - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section

  {

    return 0.0001;    

  }

二:一般不使用group,除非是要限制头尾视图要跟着tableview的滑动而滑动时候

 原创作品,有问题可以留言讨论,谢谢....

 文章内容为本人亲测好使,如解决不了您的问题,请继续研究,如有雷同,纯属巧合

原文地址:https://www.cnblogs.com/ccw-congcong/p/6726160.html