【问题标题】:CellForRowAt doesn't calling after changing tableview height更改 tableview 高度后 CellForRowAt 不调用
【发布时间】:2016-09-29 02:10:27
【问题描述】:

当我从数据库加载数据并第一次调用tableView.reloadData()tableHeightConstraint.constant = tableView.contentSize.height 时,它运行良好。但是当我添加新单元并再次执行时,它不起作用。没有tableHeightConstraint.constant = tableView.contentSize.height 可以工作,但是我不能改变tableView 的高度。更改tableView 高度很重要。

【问题讨论】:

    标签: swift uitableview constants


    【解决方案1】:

    UITableView 不是一个简单的 UIScrollView,它的 ContentSize 来自当前视图屏幕中的单元格,而不是所有单元格。

    如果您在当前视图边界之外添加一个单元格,它不会更改 ContentSize。

    猜你喜欢
    • 2020-02-15
    • 2013-01-16
    • 1970-01-01
    • 1970-01-01
    • 2018-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多