关于TableView上有一段留白的解决方法

  • 当cell的类型是plaint类型时

直接设置self.automaticallyAdjustsScrollViewInsets=NO;
还有要注意检查你自己设置的frame是否正确
 
 
  • 当cell的类型是group类型时

此时要去掉tableView顶部的空白需要两步:
1.设置tableView的tableHeaderView高度为0.5;
self.MenuTable.tableHeaderView=[[UIview alloc] initWithFrame:(CGRectMake(0,20,82,0.5))];
2.设置heightForHeaderInSection的高度为0.5
-(CGFloat)tableView:(UItableView *)tableView heightForHeaderInSection(NSInteger)section{
return 0.5;
}
原文地址:https://www.cnblogs.com/dabaomo/p/5356017.html