第16月第25天 tableView设置UITableViewStyleGrouped顶部有空余高度

1.

 正确的处理方法

   1)设置标头的高度为特小值 (不能为零 为零的话苹果会取默认值就无法消除头部间距了)


 
  1. UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 0.001)];  
  2. view.backgroundColor = [UIColor redColor];  
  3. self.tableView.tableHeaderView = view;  

   2)写代理方法(中间的留白其实是段尾的高度 代理的作用设置段尾的高度 返回值也不能为0(设置为0 在ios看来等于未设置))


 
    1. -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{  
    2.      return 0.01f;   
    3.     或者  
    4.     return CGFLOAT_MIN; 

http://blog.csdn.net/lxl_815520/article/details/51799370

原文地址:https://www.cnblogs.com/javastart/p/8349906.html