我正在使用github中的聊天布局。在这一点上,我面临着卷轴的问题。当表视图中的内容增长时,新内容必须自动可见,而不会被用户滚动。我不知道如何在这个框架中修复这个错误。
我浏览了您的库。请添加这行代码以滚动到最后一个位置。
在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)