2017-04-22 13 views

答えて

0

これを行うには、dispatch_group_tを使用することができます。

dispatch_group_t group = dispatch_group_create(); 
for (NSURL *url in urls) { 
    dispatch_group_enter(group); 
    [[[SDWebImageManager sharedManager] imageDownloader] downloadImageWithURL:url options:SDWebImageDownloaderLowPriority progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) { 
     if (image) { 
      // download success 
     } 
     NSLog(@"download..."); 
     dispatch_group_leave(group); 
    }]; 
} 

dispatch_group_notify(group, dispatch_get_main_queue(), ^{ 
    NSLog(@"all download..."); 
}); 
関連する問題