使用此代码滚动到 Collection View 的底部。但是它只会滚动到倒数第二个。
private func scrollToBottom() {
let lastSectionIndex = (ChatCollectionView?.numberOfSections())! - 1
let lastItemIndex = (ChatCollectionView?.numberOfItemsInSection(lastSectionIndex))!-1
let indexPath = NSIndexPath(forItem: lastItemIndex, inSection: lastSectionIndex)
ChatCollectionView!.scrollToItemAtIndexPath(indexPath, atScrollPosition: UICollectionViewScrollPosition.Bottom, animated: false)
}
有人熟悉这样的错误吗
最佳答案
您的 Collection View 的框架位于可见区域下方。您应该将其底部设置在可见区域内。
关于ios - 奇怪的错误,当尝试滚动到底部时,collectionView View 滚动到倒数第二条消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38799838/