请将文档目录中的图像加载到collectionView时创建自定义collectionView我无法快速滚动自定义collectionView滚动时看起来不稳定我不知道为什么? 请有人能告诉我这个问题在做什么
以下我的代码:
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as! AlbumImagesCollectionViewCell
if dictionaryOfSelectItem.count > 0 {
if dictionaryOfSelectItem[indexPath.row] == indexPath.row {
cell.imageViewCheck.image = UIImage(named: "check.png")
}else {
cell.imageViewCheck.image = nil
}
}
cell.imageViewCheck.image = nil
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
dispatch_sync(dispatch_get_main_queue(), {
if self.arrayOfImageUrl2.count > 0 && self.arrayOfImagesFromDocumentDirectory.count > 0 {
cell.imageViewCell.image = self.ResizeImage(self.arrayOfImagesFromDocumentDirectory[indexPath.row], targetSize: CGSize(width: 140.0, height: 140.0))
cell.imageUrlLabel.text = self.arrayOfImageUrl2[indexPath.row]
}
})
}
return cell
}
谢谢你提前