日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

轻量级UIImageView分类缓存 库 AsyncImageView 使用

發布時間:2025/4/5 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 轻量级UIImageView分类缓存 库 AsyncImageView 使用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

輕量級UIImageView分類緩存 庫 AsyncImageView 使用

一:

  • AsyncImageView 主頁:https://github.com/nicklockwood/AsyncImageView
  • 只包含了一個 .h 一個 .m文件
  • 兼容 iOS 5.0及以上,以及ARC

二:使用

? ?主要演示結合UITableview的使用

? ? demo代碼:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {static NSString *CellIdentifier = @"Cell";UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];if (cell == nil){//create new cellcell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];//common settingscell.selectionStyle = UITableViewCellSelectionStyleNone;cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;cell.imageView.contentMode = UIViewContentModeScaleAspectFill;cell.imageView.frame = CGRectMake(0.0f, 0.0f, 44.0f, 44.0f);cell.imageView.clipsToBounds = YES;}else{//cancel loading previous image for cell [[AsyncImageLoader sharedLoader] cancelLoadingImagesForTarget:cell.imageView];}//set placeholder image or cell won't update when image is loadedcell.imageView.image = [UIImage imageNamed:@"Placeholder.png"];//load the imagecell.imageView.imageURL = self.imageURLs[(NSUInteger)indexPath.row];//display image pathcell.textLabel.text = [[(NSURL *)self.imageURLs[(NSUInteger)indexPath.row] path] lastPathComponent];return cell; } View Code

?

? ? ?demo 代碼:

??

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {static NSString *CellIdentifier = @"Cell";#define IMAGE_VIEW_TAG 99UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];if (cell == nil){//create new cellcell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];//add AsyncImageView to cellAsyncImageView *imageView = [[AsyncImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 44.0f, 44.0f)];imageView.contentMode = UIViewContentModeScaleAspectFill;imageView.clipsToBounds = YES;imageView.tag = IMAGE_VIEW_TAG;[cell addSubview:imageView];//common settingscell.selectionStyle = UITableViewCellSelectionStyleNone;cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;cell.indentationWidth = 44.0f;cell.indentationLevel = 1;}//get image viewAsyncImageView *imageView = (AsyncImageView *)[cell viewWithTag:IMAGE_VIEW_TAG];//cancel loading previous image for cell [[AsyncImageLoader sharedLoader] cancelLoadingImagesForTarget:imageView];//load the imageimageView.imageURL = [_imageURLs objectAtIndex:indexPath.row];//display image pathcell.textLabel.text = [[[_imageURLs objectAtIndex:indexPath.row] path] lastPathComponent];return cell; } View Code

?

三:可用api

??

@interface AsyncImageLoader : NSObject+ (AsyncImageLoader *)sharedLoader; + (NSCache *)defaultCache;@property (nonatomic, strong) NSCache *cache; @property (nonatomic, assign) NSUInteger concurrentLoads; @property (nonatomic, assign) NSTimeInterval loadingTimeout;- (void)loadImageWithURL:(NSURL *)URL target:(id)target success:(SEL)success failure:(SEL)failure; - (void)loadImageWithURL:(NSURL *)URL target:(id)target action:(SEL)action; - (void)loadImageWithURL:(NSURL *)URL; - (void)cancelLoadingURL:(NSURL *)URL target:(id)target action:(SEL)action; - (void)cancelLoadingURL:(NSURL *)URL target:(id)target; - (void)cancelLoadingURL:(NSURL *)URL; - (void)cancelLoadingImagesForTarget:(id)target action:(SEL)action; - (void)cancelLoadingImagesForTarget:(id)target; - (NSURL *)URLForTarget:(id)target action:(SEL)action; - (NSURL *)URLForTarget:(id)target;@end@interface UIImageView(AsyncImageView)@property (nonatomic, strong) NSURL *imageURL;@end@interface AsyncImageView : UIImageView@property (nonatomic, assign) BOOL showActivityIndicator; @property (nonatomic, assign) UIActivityIndicatorViewStyle activityIndicatorStyle; @property (nonatomic, assign) NSTimeInterval crossfadeDuration;@end View Code

?

?

總結

以上是生活随笔為你收集整理的轻量级UIImageView分类缓存 库 AsyncImageView 使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 三级视频在线观看 | 国产精品老熟女视频一区二区 | 高清中文字幕av | 欧美人与动牲交xxxxbbbb | 欧美三级日本三级 | 日本捏奶吃奶的视频 | 最近中文字幕第一页 | 久久久天堂 | 天天舔天天射天天干 | 亚洲成人午夜在线 | 99在线观看免费 | av无码精品一区二区三区宅噜噜 | 日本不卡视频一区 | 日韩精品久久一区二区 | 午夜日韩电影 | 毛片毛片毛片毛片毛片毛片毛片毛片 | 美女黄视频网站 | 中文字幕一区二区三区视频 | av视| 午夜性影院| 国产伦精品一区二区. | 污污视频在线 | 偷偷操网站| 精品国产不卡 | 色播久久 | 欧美日韩免费一区二区 | 人人av在线| 日韩美女啪啪 | 91在线观看视频网站 | 中文字幕在线视频第一页 | 亚洲成a人片在线www | 日本亚洲在线 | 青青草91 | 国产精品第9页 | 在线中文字幕网站 | 精品国产乱码久久久久久影片 | 亚洲熟妇中文字幕五十中出 | 亚洲欧洲一区二区在线观看 | 日韩精品中文在线 | 久久国产在线视频 | 亚洲综合在线中文字幕 | 亚洲精品国产欧美 | 91草草草| 在线观看 亚洲 | 免费毛片在线播放 | 亚洲网址在线 | 久久成人激情 | 亚洲视频大全 | 美女网站免费视频 | 久久露脸 | 色综合天天综合网国产成人网 | 免费不卡的av | 一区免费观看 | 亚洲激情午夜 | 在线成人毛片 | 亚洲是色 | 校园春色综合网 | 少妇被躁爽到高潮无码人狍大战 | 精品久久久久久无码中文野结衣 | 成人黄色激情网 | 秋霞欧美一区二区三区视频免费 | 手机亚洲第一页 | 午夜爽爽爽视频 | 国产精品嫩草69影院 | 日av中文字幕 | 最新免费黄色网址 | 狼人伊人久久 | 亚洲电影中文字幕 | 骚虎av| 欧美激情综合色综合啪啪五月 | 欧美精品黄色 | 性欧美另类 | 青青草娱乐视频 | www.com捏胸挤出奶 | 日韩亚洲国产欧美 | 欧美天天 | 日韩中文一区二区三区 | 亚洲乱码国产乱码精品精大量 | 极品色影视 | av手机网站| 午夜日韩 | 成人免费在线观看 | 五月丁香花 | 日韩成人精品在线观看 | 成人看片泡妞 | 免费看国产黄色 | 久久永久免费视频 | 亚洲AV无码精品久久一区二区 | 啪啪在线视频 | 亚洲aⅴ在线 | 可以在线看的av | 国产成人不卡 | 国产精品不卡一区二区三区 | 国产欧美久久一区二区三区 | 一级黄色影院 | 国产剧情一区二区三区 | 九九视频免费 | 欧美色噜噜 | 99热在线看 |