ios - 每当内容在 LynnBubbleTableView 框架中增长时,如何移动到 tableview 的底部?

标签 ios swift uitableview

我正在使用 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/

相关文章:

ios - iOS 中的富文本编辑器

ios - ios 中 TableView 的 scrollviewBeginDragging 不起作用

ios - UITableViewCell ImageView Resize - 选定的行改变图像大小

ios - 具有 Image SubView 性能问题的 TableView

ios - 将 NSString 更改为 int 值?

ios - 每个 Xcode 方案的权利/能力

ios - 如何使用 SQLite.swift 使用 "start of month"sqlite 日期修饰符

ios - 如何通过 CollectionView 中的 Flow Layout 将单元格对齐到顶部

ios - 方法调用预期的参数过多,有2

ios - 居中 UILabel 不起作用?