Ily*_*lya 1 uitableview uikit ios
使用以下代码:
let tableView = ...
let oldSize = tableView.contentSize // header + all rows + footer
tableView.tableHeaderView.bounds.height -= 10
tableView.tableFooterView.bounds.height -= 10
Run Code Online (Sandbox Code Playgroud)
你会看到:
assert(tableView.contentSize != oldSize) // ERROR: assertion fails
Run Code Online (Sandbox Code Playgroud)
诀窍是重新设置tableHeaderView
或tableFooterView
:
let tableView = ...
let oldSize = tableView.contentSize // header + all rows + footer
tableView.tableHeaderView.bounds.height -= 10
tableView.tableHeaderView = tableView.tableHeaderView
tableView.tableFooterView.bounds.height -= 10
tableView.tableFooterView = tableView.tableFooterView
assert(tableView.contentSize != oldSize) // no error :)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1671 次 |
最近记录: |