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

2017-06-12  本文已影响27人  iOS虞

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

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

上一篇 下一篇

猜你喜欢

热点阅读