这就是我如何更改首先从 Storyboard加载的 tableFooterView:
有时我会更改 tableFooterView
并将新的 ContentSize 分配给 tableView
:
self.tableView.tableFooterView?.frame.size.height = 400
var newContentSize = self.tableView.contentSize
newContentSize.height += 400
self.tableView.contentSize = newContentSize
但它不起作用,因为滚动结束并且 tableFooterView 超出滚动范围。为什么?
最佳答案
如果我们更改 tableFooterView
的框架,tableView
不会意识到这一点,因此它的 contentSize
不会正确更改。它需要做的就是分配全新的 tableFooterView
:
let newTableFooterView = self.tableView.tableFooterView
newTableFooterView.frame.size.height = 400
self.tableView.tableFooterView = newTableFooterView
关于ios - 更改 tableFooterView 的框架时没有适当的滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32585028/