您的位置:首页 > 移动开发 > IOS开发

【iOS开发】关于图片加载的第三方框架SDWebImage的使用

2015-06-12 15:13 911 查看
SDWebImage是一个第三方框架,用于加载网络图片,还有其他一些好的功能

使用步骤

下载地址

https://github.com/rs/SDWebImage

下载以后解压,解压以后是下图



然后将文件中的SDWebImage文件夹拖到项目中,然后在项目中使用

使用框架

#import "SDWebImage/UIImageView+WebCache.h"//引入头文件

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *ID = @"video";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];

if(cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
}

NSString *imageUrl = [NSString stringWithFormat:@"http://192.168.1.101:8080/TFServer/%@", video.image];

//使用这个框架
[cell.imageView setImageWithURL:[NSURL URLWithString:imageUrl] placeholderImage:[UIImage imageNamed:@"4.jpg"]];

return cell;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: