美文网首页
TableView分组头高度,脚高度设置没反应

TableView分组头高度,脚高度设置没反应

作者: iOS虞 | 来源:发表于2017-06-12 15:56 被阅读27次

swift3.0 

TableView头高度和脚高度

func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {

return 4

}

func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {

return 2

}

我是一只是这样设置的但是在用swift4.0时设置没有卵用了~~~~~~~~~~~~~

在创建TableView时添加1,2  或 3,4两行代码

tableview.estimatedSectionHeaderHeight = 4

tableview.estimatedSectionFooterHeight = 2

tableview.sectionHeaderHeight = 4

tableview.sectionFooterHeight = 2

运行解决~~~~~~~~~

相关文章

网友评论

      本文标题:TableView分组头高度,脚高度设置没反应

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