简体   繁体   English

SDWebImage下载多个图像(iOS)

[英]SDWebImage Downloading Multiple Images (iOS)

For my iPhone app, I am trying to use SDWebImage to download multiple images from a list of links. 对于我的iPhone应用程序,我试图使用SDWebImage从链接列表中下载多个图像。 The problem is after the images are downloaded, I don't know how to find out which image was downloaded from what link. 问题是下载图像后,我不知道如何从哪个链接中下载了哪个图像。

For example, I have a list of 25 image links. 例如,我有25个图像链接的列表。 I use the following code for each link, where downloader is an instance of SDWebImageDownloader: 我对每个链接使用以下代码,其中downloader是SDWebImageDownloader的一个实例:

downloader = [SDWebImageDownloader downloaderWithURL:url delegate:self];

The above code starts the downloading process and once the image is downloaded, the following code is called: 上面的代码开始下载过程,下载图像后,将调用以下代码:

- (void)imageDownloader:(SDWebImageDownloader *)downloader didFinishWithImage:(UIImage *)image 

From the above method, I can see the list of all my 25 images, but they are not in order (obviously). 通过上面的方法,我可以看到所有25张图像的列表,但它们的顺序不正确(很明显)。 I was wondering if there is a way to keep a track of images and their corresponding image links. 我想知道是否有一种方法可以跟踪图像及其对应的图像链接。 Any suggestions? 有什么建议么?

SDWebImageDownloader has an URL property, which is the corresponding image link: SDWebImageDownloader具有URL属性,它是相应的图像链接:

- (void)imageDownloader:(SDWebImageDownloader *)downloader didFinishWithImage:(UIImage *)image 
{
    NSString* url = downloader.url;   
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM