第三方加载图片
来源:互联网 发布:中国黑科技知乎 编辑:程序博客网 时间:2024/04/29 10:16
#import "TableViewCell.h"#import "ImageModal.h"// 下载图片(MRC)#import "UIImageView+WebCache.h"@implementation TableViewCell#pragma mark - 给cell赋值方法- (void)setCellModal:(ImageModal *)modal{ // 第三方 可以付动态图 [self.pictureImageView sd_setImageWithURL:[NSURL URLWithString:modal.imageUrlString] placeholderImage:[UIImage imageNamed:@"5.png"]];}cellForRowAtIndexPath// cellForRowAtIndexPath- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifier = @"TableViewCell"; TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; ImageModal *modal = self.dataArray[indexPath.row]; [cell setCellModal:modal]; cell.titleLabel.text = modal.title; return cell;}
利用第三方 MBProgressHUD
#pragma mark - 网络请求- (void)loadDataFromNetWork{ NSString *urlString = @"http://project.lanou3g.com/teacher/yihuiyun/lanouproject/activitylist.php"; // 显示进度条(解析数据前) [MBProgressHUD showHUDAddedTo:self.mainTableView animated:YES]; // 解析数据(第三方) JSONAnalysis *json = [[JSONAnalysis alloc] initWithGETRequest:urlString]; [json didFinishUsingBlock:^(id jsonObject) { // 解析 NSArray *array = jsonObject[@"events"]; for (NSDictionary *dict in array) { ImageModal *modal = [[ImageModal alloc] init]; [modal setValuesForKeysWithDictionary:dict]; modal.imageUrlString = dict[@"image"]; [self.dataArray addObject:modal]; // 隐藏进度条(解析完数据) [MBProgressHUD hideHUDForView:self.mainTableView animated:YES]; } // 刷新cell(解析完数据) [self.mainTableView reloadData]; }];}清除缓存 // 清除缓存 [[SDImageCache sharedImageCache] cleanDisk]; [[SDImageCache sharedImageCache] clearDisk];
0 0
- 第三方加载图片
- 第三方加载图片
- 加载第三方图片
- 图片加载 第三方 KVO
- 第三方图片加载库
- 第三方图片加载ImageLoader
- 用第三方库加载缓存图片
- SDWebImage 第三方类图片异步加载
- SDWebImage第三方库加载图片生硬
- 第三方图片加载框架对比分析
- 第三方框架--加载网络图片
- Fresco第三方的图片加载
- 第三方异步加载图片(简单使用)
- android利用多线程加载图片【不使用第三方库】
- Android第三方图片加载库Universal Image Loader
- 怎样在Cell中使用第三方库加载图片
- iOS UI 16 图片加载第三方 SDwebimage
- 使用ImageLoader第三方框架,加载网络图片
- CRgn::CreateEllipticRgnIn
- 【UVA796】【无向图割边】
- Python 之 将 list 存储为 .mat 文件
- hadoop异常:虚拟机上搭建分布式集群org.apache.hadoop.ipc.Client: Retrying connect to server
- [MFC]对话框创建的基本步骤、定义对话框模板
- 第三方加载图片
- 遇见二十年后的父母
- Android Camera HAL浅析
- VIM配置笔记(cscope+NERDTree)
- 观察者KVO
- php中self和$this的用法
- myeclipse 10安装svn插件
- C++中unordered_map出现的若干问题详解(找不到库,找不到unorded_map,编译问题)
- ubuntu安装redis