CollectionView单元崩溃-断言失败

时间:2019-04-30 06:17:07

标签: ios swift

当我在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。请建议我解决此问题

0 个答案:

没有答案