美文网首页
iOS-UITableView使用UITableViewStyl

iOS-UITableView使用UITableViewStyl

作者: MonsterNanny | 来源:发表于2016-03-25 10:06 被阅读1208次
  • sectionHeader使用此方法
- ( CGFloat )tableView:( UITableView *)tableView heightForHeaderInSection:( NSInteger )section
{
//对于section == 0 时返回0.01因为 不能返回0 返回0系统会返回自己的默认值
       return section == 0 ? 20 : 0.01;
}
  • sectionFooter这个方法无效
- ( float )tableView:( UITableView *)tableView heightForFooterInSection:( NSInteger )section{
       return 10.0;
} 

需要使用:self.tableView.sectionFooterHeight = 0;
sectionFooterHeight 这个距离的计算是sectionHeader + sectionFooter的高度。

  • 同时设置
self.tableView.sectionFooterHeight = 0;
self.tableView.sectionHeaderHeight = 0; 

会彻底把间隔弄走

相关文章

网友评论

      本文标题:iOS-UITableView使用UITableViewStyl

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