本文主要是介绍【iOS开发】关于图片加载的第三方框架SDWebImage的使用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
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的使用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!