当前位置: 首页 > news >正文

学习做网站建设的学校设计师网站导航

学习做网站建设的学校,设计师网站导航,05网数学书答案,福州网站排名推广刚刚更新pods 编译程序,突然发现SDWebImage报错 了解到SDWebImage4.0 更换了不少方法#xff0c;还增加了几个类#xff0c;索性都研究一下pod 更新SDWebImage版本为4.1.0 查找是否有对应缓存的 方法 由返回BOOL 值 换成Block回调中参数返回BOOL值 //老版本 BOOL isInCache …刚刚更新pods 编译程序,突然发现SDWebImage报错 了解到SDWebImage4.0 更换了不少方法还增加了几个类索性都研究一下 pod 更新SDWebImage版本为4.1.0 查找是否有对应缓存的 方法 由返回BOOL 值 换成Block回调中参数返回BOOL值 //老版本 BOOL isInCache [[SDImageCache sharedImageCache]diskImageExistsWithKey:];// 4.0 版本[[SDImageCache sharedImageCache]diskImageExistsWithKey: completion:^(BOOL isInCache) {}]; 复制代码删除沙盒图片 只有 带Block回调的了 老版本 - (void)clearMemory; - (void)clearDiskOnCompletion:(SDWebImageNoParamsBlock)completion; - (void)clearDisk; 4.0 版本 - (void)clearMemory; - (void)clearDiskOnCompletion:(nullable SDWebImageNoParamsBlock)completion; 复制代码下载图片的方法 方法名字由downloadImageWithURL 换成loadImageWithURL 1.在加载进度的Block回调里 增加了targetURL 图片URL的参数 2.在下载完成的Block回调里 增加了 data 返回二进制 //老版本[[SDWebImageManager sharedManager]downloadImageWithURL:[NSURL URLWithString:] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {} completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { }]; //4.0 版本 [[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:[imageArray objectAtIndex:i]] options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize, NSURL * _Nullable targetURL) {} completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { }]; 复制代码UIImageViewWebCache UIButtonWebCache等category 的方法并没改变 只是里面的图片替换逻辑 移动到新增的UIView WebCache 里了 - (void)sd_setImageWithURL:(nullable NSURL *)urlplaceholderImage:(nullable UIImage *)placeholderoptions:(SDWebImageOptions)optionsprogress:(nullable SDWebImageDownloaderProgressBlock)progressBlockcompleted:(nullable SDExternalCompletionBlock)completedBlock {[self sd_internalSetImageWithURL:urlplaceholderImage:placeholderoptions:optionsoperationKey:nilsetImageBlock:nilprogress:progressBlockcompleted:completedBlock]; } 复制代码增加了个UIView WebCache category 此类作用是把SDWebImage 所有的 category 如 UIButtonWebCacheUIImageViewWebCache 等分类的图片替换的逻辑 封装到 一起使用。 - (void)sd_internalSetImageWithURL:(nullable NSURL *)urlplaceholderImage:(nullable UIImage *)placeholderoptions:(SDWebImageOptions)optionsoperationKey:(nullable NSString *)operationKeysetImageBlock:(nullable SDSetImageBlock)setImageBlockprogress:(nullable SDWebImageDownloaderProgressBlock)progressBlockcompleted:(nullable SDExternalCompletionBlock)completedBlock; 复制代码SDWebImage4.0 播放GIF 需要使用 FLAnimatedImage 如果使用了用pods 除了pod SDWebImage 还要添加下面俩个 pod SDWebImage/GIF pod FLAnimatedImage //使用很简单 #import FLAnimatedImageView.h #import FLAnimatedImageViewWebCache.hFLAnimatedImageView *FLView [[FLAnimatedImageView alloc]init];FLView.frame CGRectMake(0, 64, SCREEN_WIDTH, 280);[FLView sd_setImageWithURL:[NSURL URLWithString:IMAGE2] placeholderImage:[UIImage imageNamed:[NSBundle zb_placeholder]]];[self.view addSubview:FLView];复制代码FLAnimatedImageViewWebCache 内部实行也很简单明了 依然调用UIView WebCache 的方法 在设置图片的Block里 对回调里的参数imageData 进行判断如果是GIF 就使用FLAnimatedImage 的animatedImageWithGIFData方法进行赋值 - (void)sd_setImageWithURL:(nullable NSURL *)urlplaceholderImage:(nullable UIImage *)placeholderoptions:(SDWebImageOptions)optionsprogress:(nullable SDWebImageDownloaderProgressBlock)progressBlockcompleted:(nullable SDExternalCompletionBlock)completedBlock {__weak typeof(self)weakSelf self;[self sd_internalSetImageWithURL:urlplaceholderImage:placeholderoptions:optionsoperationKey:nilsetImageBlock:^(UIImage *image, NSData *imageData) {SDImageFormat imageFormat [NSData sd_imageFormatForImageData:imageData];if (imageFormat SDImageFormatGIF) {weakSelf.animatedImage [FLAnimatedImage animatedImageWithGIFData:imageData];weakSelf.image nil;} else {weakSelf.image image;weakSelf.animatedImage nil;}}progress:progressBlockcompleted:completedBlock]; }复制代码FLAnimatedImageView本身就是UIImageView的封装 用起来真的很快配合SDWebImage加载GIF 都感觉不到下载的过程以为是本地加载的一样 .在正常UITableView 列表试了下加载普通图片更是小意思。完全可以替换UIImageView 增加了一个SDImageCacheConfig 类 把之前在SDImageCache 类里初始化的几个属性拿出来单独封装使其他类也能使用 增加了 NSImageWebCache category macOS 平台开发时使用的一个 NSImage 的一个分类 不用太了解 我也只是 粗略的看了看 具体还有哪些改变漏掉的以后再补充
http://www.zqtcl.cn/news/621916/

相关文章:

  • 网站建设方案 文库新乡网站seo优化
  • 网站优化需要什么软件有没有帮别人做网站
  • 做国外网站选择vps汉中公司做网站
  • ipad网站开发百度推广送的公司网站有什么用
  • 网站被收录wordpress模板游戏推广
  • 做个网站成功案例深圳网络推广工资
  • 河南省城乡与住房建设厅网站做网站的都是什么专业毕业的
  • 做网站月薪10万微信网页开发教程
  • 网站开发组岗位上海著名企业
  • 阿里云网站建设方案网站源码分享
  • 设计感很强的中文网站公司专业网页制作
  • 自己制作网站做外贸赚钱吗什么是网站html静态化
  • 网站中的搜索功能怎么做的网站空间价格
  • 网站内容收费WordPress之类的
  • 好网站推荐一下网站建设客户评价
  • 重庆交通网站建设wordpress08模板
  • 网站搭建响应式wordpress访客切换主题
  • 标准网站建设推荐帮别人做网站开票开什么税目
  • 温州网站优化衡阳县专业做淘宝网站
  • 门户网站建设存在的问题和差距无锡做智能网站
  • 受欢迎的常州做网站网站制作ppt
  • 物流网站建设实例 天堂资源帝
  • 太原建设厅官方网站wordpress 导入工具
  • 做网站树立品牌形象建设了网站后怎么用谷歌引流
  • 专业公司网站建设建设人才库网站
  • 怎么自己做直播网站吗手机免费建站app
  • 惠州规划建设局网站seo网站关键词排名优化公司
  • 关键词检测百度seo一本通
  • 做效果图的外包网站徐州低价seo
  • xp系统中做网站服务器吗网站设计版权