首页 > 移动平台 > 详细

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

时间:2015-06-12 17:31:48      阅读:223      评论:0      收藏:0      [点我收藏+]

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;
}

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

原文:http://blog.csdn.net/ttf1993/article/details/46471965

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!