【问题标题】:why UITableViewAutomaticDimension not working for sectionFooterHeight?为什么 UITableViewAutomaticDimension 不适用于 sectionFooterHeight?
【发布时间】:2016-03-03 10:30:52
【问题描述】:

您好,有很多问题可以回答UITableViewCell 的动态高度UITableView。但是,当我为sectionFooterHeight 这样做时,我觉得很奇怪。

代码为:

 tableView.sectionHeaderHeight = UITableViewAutomaticDimension
 tableView.estimatedSectionHeaderHeight = 25

 tableView.sectionFooterHeight = UITableViewAutomaticDimension
 tableView.estimatedSectionFooterHeight = 50

并在xib 中为页脚视图设置了约束

虽然它适用于headerview,但不适用于页脚

【问题讨论】:

    标签: ios swift uitableview


    【解决方案1】:

    我认为您需要实现tableView:heightForFooterInSection: 并返回UITableViewAutomaticDimension

    【讨论】:

    • 如果这也不起作用,你有一些约束设置错误
    • 这不是真的
    【解决方案2】:

    将estimateSectionFooterHeight 设置为一个数字并将sectionFooterHeight 设置为UITableViewAutomaticDimension 后,您可以实现tableView:heightForFooterInSection: 并返回tableView.sectionFooterHeight

    【讨论】:

    • 请详细说明你的答案。
    猜你喜欢
    • 1970-01-01
    • 2015-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-12
    • 1970-01-01
    • 2017-05-08
    • 1970-01-01
    相关资源
    最近更新 更多