fix scroll to button not always works

This commit is contained in:
ryanzhao 2021-07-16 13:27:27 +10:00
parent d2161545d6
commit 221eabc496
1 changed files with 4 additions and 1 deletions

View File

@ -18,7 +18,10 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
}
func handleScrollToBottomButtonTapped() {
scrollToBottom(isAnimated: true)
// The tableview's content size will be calculated by the estimated height of cells,
// so the result may be inaccurate before all the cells are loaded.
// Use this scroll to the last row instead.
messagesTableView.scrollToRow(at: IndexPath(row: viewItems.count-1, section: 0), at: .top, animated: true)
}
// MARK: Blocking