我正在使用 ASCollectionNode 水平滚动,我正在尝试向左存档滚动以加载更多并插入项目。但是当我到达左侧的最后一项时,项目被插入左侧而不是右侧。
我实现了这样的插入..
func addRowsIntoPhotoCollection(newPhotoCount newPhotos: Int) {
let indexRange = (photoFeedModel.numberOfItems - newPhotos..<photoFeedModel.numberOfItems)
let indexPaths = indexRange.map { IndexPath(row: $0, section: 0) }
collectionView.performBatchUpdates({
collectionView.insertItems(at: indexPaths)
}) { (done) in
if self.shouldScroll == true {
self.scrollToBeginning()
}
}
}