每次添加新部分时,我都会尝试将表格滚动到底部。它们的部分可能有也可能没有任何行,但仍然需要滚动到底部。有办法做到这一点吗?
最佳答案
你可以尝试这样的事情:
func scrollToBottom() {
let bottomOffset = CGPoint(x: 0, y: tableView.contentSize.height - tableView.bounds.size.height + tableView.contentInset.bottom);
tableView.setContentOffset(bottomOffset, animated: true)
}
关于快速滚动到只有空白部分的表格底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38361316/