【发布时间】:2017-10-15 15:57:40
【问题描述】:
我有一个包含聊天消息的表格视图。我正在尝试滚动到表格视图的底部,但它只滚动了一半。我怀疑这与单元格的高度不同(因为有些消息比其他消息长)有关。
有没有办法完全滚动到底部而不是基于平均单元格高度?
这是我用来滚动到底部的代码:
let lastIndex = IndexPath(row: messages.count - 1, section: 0)
self.tableview.scrollToRow(at: lastIndex, at: .bottom, animated: true)
【问题讨论】:
标签: ios uitableview scroll swift4