【发布时间】:2020-07-29 05:45:21
【问题描述】:
我有一个显示消息的集合视图。现在它加载消息然后滚动到底部
let indexPath = IndexPath(item: self.messages.count - 1, section: 0)
self.collectionView?.scrollToItem(at: indexPath, at: .bottom, animated: true)
这可行,但有大量消息和 collectionview 项目,它滚动非常缓慢并且非常不稳定。 我想要发生的是集合视图从底部开始,并且不必滚动浏览所有消息并且看起来就像在消息上所做的那样。这个我也试过了,还是不行
let point = CGPoint(x: 0, y: self.collectionView.frame.size.height)
self.collectionView.setContentOffset(point, animated: false)
【问题讨论】: