当我在Closure中重新加载UICollectionView
单元格时,出现以下错误
-[UICollectionView中的断言失败 _endItemAnimationsWithInvalidationContext:tentativelyForReordering:动画师:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore/UIKit-3698.84.16/UICollectionView.m:6120 (lldb)
DispatchQueue.global(qos: .userInteractive).async {
self!.fillCellImage(pixbayUrl: self.pixabayPhotoArray[indexPath.row].webformatURL!, photoId: indexPath.row) { (image, id) in
DispatchQueue.main.async {
let indexPath = IndexPath(item: id, section: 0)
if(self.photosArray[indexPath.row].isDownloadImage == true){
self.PixbayPhotoCollectionView.reloadItems(at: [indexPath])
}else{
self.photosArray[id].isDownloadImage = image.isDownloadImage
self.photosArray[id].image = image.image
if self.PixbayPhotoCollectionView != nil {
self.PixbayPhotoCollectionView.reloadItems(at: [indexPath])
}
}
}
}
}
下载图片后,我重新加载了UICollectionView
。请建议我解决此问题