Load image to UICollectionView Asynchronously?

后端 未结 3 2067
长情又很酷
长情又很酷 2020-12-29 15:46

How can i load images to a UICollectionview asynchronously? Inside following method?

- (PSTCollectionViewCell *)collectionView:(PSTCollectionVie         


        
3条回答
  •  不思量自难忘°
    2020-12-29 16:45

    This code creates serial queue:

    dispatch_queue_t imageLoadQueue = dispatch_queue_create("com.GMM.assamkar", NULL);
    

    therefore each task IN QUEUE is performed in the same thread successive. Therefore your single work thread is sustained by sleep for each task of loading that slow down all process of loading.

    Use asynchronous CONCURRENT queue by using something like that:

    dispatch_queue_t imageLoadQueue = dispatch_queue_create("com.GMM.assamkar", DISPATCH_QUEUE_CONCURRENT);
    

提交回复
热议问题