[英]want to know if the image is not available at url using SDWebImage
in my application i am downloading an image from url from webservice using SDWebImage Library. 在我的应用程序中,我正在使用SDWebImage库从Web服务的url下载图像。 I have nothing problem with this code 我没有这个代码的问题
[imgQuestionContainer sd_setImageWithURL:[NSURL URLWithString:@"url"] placeholderImage:@"abc.png" options:SDWebImageProgressiveDownload];
with above code i have successfully load the image in imageview... 使用上面的代码,我已经成功将图像加载到imageview中...
But my problem is that if i have url for the image but image is not available at that particular path of url. 但是我的问题是,如果我有图片的网址,但是该网址的特定路径处没有图片。 So, how to know that image is not available so i can load next data. 因此,如何知道该图像不可用,以便我可以加载下一个数据。
Thanks. 谢谢。
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]
success:^(UIImage *image) {
if(image){
}else{
}
}
failure:^(NSError *error) {
}];
];
This is what exactly i wanted. 这正是我想要的。
[imgQuestionContainer sd_setImageWithURL:[NSURL URLWithString:[[arrOfLoadedPuzzel objectAtIndex:0] objectForKey:@"puzzle_question"]]
placeholderImage:nil
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL)
{
if(error)
{
// image is not available
}
else
{
// image is available
}
}];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.