我正在使用 this chat layout from github .因为我正面临这个滚动问题。当 tableview 中的内容增长时,新内容必须自动可见,而无需用户滚动。我不知道如何修复此框架中的此错误。
最佳答案
我浏览了你的图书馆。请添加这些代码行以滚动到最后一个位置。
在 self.tbBubbleDemo.reloadData() 之后:
let lastSectionIndex = self.tbBubbleDemo!.numberOfSections - 1
// Then grab the number of rows in the last section
let lastRowIndex = self.tbBubbleDemo!.numberOfRows(inSection: lastSectionIndex) - 1
// Now just construct the index path
let pathToLastRow = IndexPath(row: lastRowIndex, section: lastSectionIndex)
// Make the last row visible
self.tbBubbleDemo?.scrollToRow(at: pathToLastRow as IndexPath, at: UITableViewScrollPosition.none, animated: true)
关于ios - 每当内容在 LynnBubbleTableView 框架中增长时,如何移动到 tableview 的底部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51299121/