SDWebImage download image
来源:互联网 发布:linux是嵌入式系统吗 编辑:程序博客网 时间:2024/05/22 00:44
/** * SDWebImage download images */ SDWebImageDownloader *downloader = [SDWebImageDownloader sharedDownloader]; [downloader downloadImageWithURL:[NSURL URLWithString:[dic objectForKey:@"pic_url"]] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) { // progression tracking code } completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) { if (image && finished) { /** * 将路径作为key */ NSString *cacheImageKey = [[SDWebImageManager sharedManager] cacheKeyForURL:[NSURL URLWithString:[dic objectForKey:@"pic_url"]]]; /** * 通过路径的key获取沙盒图片的路径 */ NSString *cacheImagePath = [[SDImageCache sharedImageCache] defaultCachePathForKey:cacheImageKey]; /** * 拿到缓存到本地的图片 */ UIImage *normalImage = [[UIImage alloc]initWithContentsOfFile:cacheImagePath]; /** * 将UIImage转成@2x的尺寸大小 */ normalImage = [UIImage imageWithCGImage:normalImage.CGImage scale:2 orientation:normalImage.imageOrientation]; homeItem.image = [normalImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; homeItem.selectedImage = [normalImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; homeVC.tabBarItem = homeItem; NSLog(@"cacheImagePath:%@",cacheImagePath); // do something with image } }]; /** * 图片下载方法 */ [imageNormal sd_setImageWithURL:[NSURL URLWithString:[dic objectForKey:@"pic_url"]] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { if (image) { imageNormal.frame = CGRectMake(0, 0, image.size.width/2, image.size.height/2); homeItem.image = [imageNormal.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; homeVC.tabBarItem = homeItem; } }];
0 0
- SDWebImage download image
- .NET Upload & Download image
- download uri form image
- download image with Alamofire
- 利用SDWebImage下载image 使用
- Where to download Dos image
- HR Employee Image upload/download
- web image sdwebimage 库的使用
- image download from google by python
- Download image file from JAX-RS
- wpf image绑定bitmap( Binding Image.Source from download memory)
- SDWebImage
- SDWebImage
- SDWebImage
- SDWebimage
- SDWebImage
- sdwebimage
- SDWebImage
- Hadoop简介
- 在 gdb 中将某段内存 dump 保存到文件中
- Oracle the network adapter could not establish the connection
- gdb查看内存地址和栈中的值—查看虚函数表、函数地址
- GDB 调试经验总结
- SDWebImage download image
- GDB 下 watch的使用
- 关于hotplug
- MVP
- MKMapView缩放显示全部annotation
- 使用Memory Analyzer tool(MAT)分析内存泄漏(二)
- GDB调试命令——反汇编相关
- 剑指offer-面试题18:树的子结构
- 1000+节点:kubernetes 1.2性能和可扩展性更新介绍