【发布时间】:2020-12-17 19:00:00
【问题描述】:
我已经阅读并查看了几篇提到这一点的帖子。我已尽力跟进,但仍有问题。
self.items.append(contentsOf: newItems)
let newIndexPath = IndexPath(item: self.items.count - 1, section: 0)
DispatchQueue.main.async {
self.collectionView.insertItems(at: [newIndexPath])
}
Items 是我拥有所有项目的数组,我正在添加 newItems。我做了一个打印,我知道有新项目。所以对于 newIndexPath 它将是下一个 items.count - 1。我尝试使用 self.items.count - 1 和 self.collectionView.numberOfItems(inSection: 0)
【问题讨论】:
标签: ios swift collectionview indexpath