草庐IT

SDWebimage

全部标签

ios - 在 Swift 中使用 UIActivityIndi​​cator-for-SDWebImage

我正在使用SDWebImage,我想添加一个加载指示器。我找到了UIActivityIndi​​cator-for-SDWebImage库,我试图通过添加以下代码将其添加到我的Swift项目中:#import"UIImageView+UIActivityIndicatorForSDWebImage.h"到我的桥接头。出于某种原因,我在设置图像URL时仍然无法访问额外参数usingActivityIndi​​catorStyle。有人知道我做错了什么吗?我试过删除.m和.h文件并重新添加它们,但没有帮助。 最佳答案 添加“use_fr

ios - 快速调整 sdwebImage 的大小

您好,我正在使用sdwebImage在我的应用程序上显示图像。我这里有一个调整图像大小的代码funcresizeImage(image:UIImage,newWidth:CGFloat)->UIImage{letscale=newWidth/image.size.widthletnewHeight=image.size.height*scaleUIGraphicsBeginImageContext(CGSizeMake(newWidth,newHeight))image.drawInRect(CGRectMake(0,0,newWidth,newHeight))letnewImage=

ios - 理解SDWebImage下载器

文档不适合我。谁能给我示例代码或实例化SDWebImage下载程序并使用downloadImageWithURL方法的示例? 最佳答案 我已经为此创建了一个类,但下面是我如何使用它:-(void)setImageURL:(NSURL*)imageURL{_imageURL=imageURL;self.image=nil;[self.layerremoveAllAnimations];if(!imageURL){self.image=self.placeHolderImage;return;}__weakSDImageView*wea

ios - SDWebImage 检查图像是否使用 Swift 缓存 : Ambiguous Reference

我试图查明是否已经使用SDWebImage缓存了图像,但是当我尝试使用此方法时,我收到错误“对成员'cachedIageExistsForURL的引用不明确”。letbool=SDWebImageManager.cachedImageExistsForURL(imgURL)我正在使用Swift,并且我有一个桥接header来使用该库。 最佳答案 cachedImageExistsForURL不是SDWebImageManager上的类方法,它是您需要在sharedInstance上使用的实例方法:SDWebImageManager.

ios - 如何获取缓存图像 SDWebImage 的数据

我正在使用SDWebImage库在我的UICollectionView中缓存网络图像:cell.packItemImage.sd_setImage(with:URL(string:smileImageUrl[indexPath.row]))但我想将缓存的图片保存在本地文件中,而不是再次下载它们FileManager.default.createFile(atPath:newPath,contents:Data(contentsOf:URL(string:snapchildvalue[Constants.smiles.smileImageUrl]as!String)!),attribut

ios - SDWebImage + UITableViewCell,滚动时图像错误?

我在使用SDWebImage将图像加载到自定义UITableViewCell内的UIImageView时遇到问题。这是我在UITableView委托(delegate)中的代码:staticNSString*userTableId=@"userTableId";UserDetailsTableViewCell*cell=(UserDetailsTableViewCell*)[tableViewdequeueReusableCellWithIdentifier:userTableId];NSDictionary*user=[userListobjectAtIndex:indexPath.

ios - SDWebImage + UITableViewCell,滚动时图像错误?

我在使用SDWebImage将图像加载到自定义UITableViewCell内的UIImageView时遇到问题。这是我在UITableView委托(delegate)中的代码:staticNSString*userTableId=@"userTableId";UserDetailsTableViewCell*cell=(UserDetailsTableViewCell*)[tableViewdequeueReusableCellWithIdentifier:userTableId];NSDictionary*user=[userListobjectAtIndex:indexPath.

iOS SDWebImage 淡入新图像

我一直在我的iPhone应用程序上使用SDWebImage来处理所有图像加载。我正在使用占位符图像,我想在新图像加载后交叉淡入淡出或淡入淡出。我正在使用成功block来设置图像,并且效果很好。无论我尝试什么,图像都不会淡入。我试过将动画代码发送回主线程,但这也无济于事。它只是立即加载...没有动画。这是我的代码。有什么想法吗?//loadplaceholderimageNSURL*url=..._imageView=[[UIImageViewalloc]init];[_imageViewsetImage:[UIImageimageNamed:@"loading.jpg"]];//req

iOS SDWebImage 淡入新图像

我一直在我的iPhone应用程序上使用SDWebImage来处理所有图像加载。我正在使用占位符图像,我想在新图像加载后交叉淡入淡出或淡入淡出。我正在使用成功block来设置图像,并且效果很好。无论我尝试什么,图像都不会淡入。我试过将动画代码发送回主线程,但这也无济于事。它只是立即加载...没有动画。这是我的代码。有什么想法吗?//loadplaceholderimageNSURL*url=..._imageView=[[UIImageViewalloc]init];[_imageViewsetImage:[UIImageimageNamed:@"loading.jpg"]];//req

ios - SDWebImage 在滚动之前不会加载远程图像

我正在使用SDWebImage库将远程图像加载到使用我创建的自定义单元格类的表格View中。我只是使用[cell.imageViewsetImageWithURL:urlplaceholderImage:[UIImageimageNamed:@"loading.jpg"]];在cellForRowAtIndexPath中:现在的问题是它只在可见单元格中加载图像,而不是在屏幕外的单元格中,我必须上下滚动才能加载它们。有什么方法可以加载所有图像而无需滚动表格View。提前致谢!! 最佳答案 如果要预取行,可以回复UIScrollView