想知道图像是否在 url 使用 SDWebImage 不可用
want to know if the image is not available at url using SDWebImage
在我的应用程序中,我使用 SDWebImage 库从 url 从网络服务下载图像。我对这段代码没有任何问题
[imgQuestionContainer sd_setImageWithURL:[NSURL URLWithString:@"url"] placeholderImage:@"abc.png" options:SDWebImageProgressiveDownload];
使用上面的代码我已经成功地在 imageview 中加载了图像...
但我的问题是,如果我有 url 图像,但图像在 url 的特定路径上不可用。那么,如何知道该图像不可用,以便我可以加载下一个数据。
谢谢。
[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) {
}];
];
这正是我想要的。
[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
}
}];
在我的应用程序中,我使用 SDWebImage 库从 url 从网络服务下载图像。我对这段代码没有任何问题
[imgQuestionContainer sd_setImageWithURL:[NSURL URLWithString:@"url"] placeholderImage:@"abc.png" options:SDWebImageProgressiveDownload];
使用上面的代码我已经成功地在 imageview 中加载了图像...
但我的问题是,如果我有 url 图像,但图像在 url 的特定路径上不可用。那么,如何知道该图像不可用,以便我可以加载下一个数据。
谢谢。
[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) {
}];
];
这正是我想要的。
[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
}
}];