IOS SDWebImage
2013-09-30 14:42
120 查看
1.SDWebImage安装配置一
下载SDWebImage:https://github.com/rs/SDWebImageInstallation
There are two ways to use this in your project: copy all the files into your project, or import the project as a static library.Add the SDWebImage project to your project
Right-click on the project navigator and select "Add Files to "Your Project":In the dialog, select SDWebImage.xcodeproj:
After you’ve added the subproject, it’ll appear below the main project in Xcode’s Navigator tree:
You may want to add the SDWebImage directory in your project source tree as a submodule before adding it to your project.
Add build target dependencies
In you application project app’s target settings, find the "Build Phases" section and open the "Target Dependencies" block:Click the "+" button and select "SDWebImage ARC" (you may choose the non ARC target if you want to support iOS <3 or the ARC+MKAnnotation if you need MapKit category):
Open the "Link Binary With Libraries" block:
Click the "+" button and select "libSDWebImageARC.a" library (use non ARC version if you chose non ARC version in the previous step):
Click the "+" button again and select the "ImageIO.framework", this is needed by the progressive download feature:
If you chose to link against the ARC+MKAnnotation target, click the "+" button again and select "MapKit.framework":
Add headers
Open the "Build Settings" tab, in the "Linking" section, locate the "Other Linker Flags" setting and add the "-ObjC" flag:In the "Search Paths" section, locate "Header Search Paths" (and not "User Header Search Paths") and add two settings:
”$(TARGET_BUILD_DIR)/usr/local/lib/include”and
”$(OBJROOT)/UninstalledProducts/include”. Double click on the
<Multiple values>to pop out the box and click on the "+" icon to add each of them. Make sure to include the quotes here:
Import headers in your source files
In the source files where you need to use the library, import the header file:#import <SDWebImage/UIImageView+WebCache.h>
Build Project
At this point your workspace should build without error. If you are having problem, post to the Issue and the community can help you solve it.Fixing indexing
If you have problem with auto-completion of SDWebImage methods, you may have to copy the header files in your project.2.SDWebImage安装配置2
下载:https://github.com/rs/SDWebImage/wiki/Download-Compiled-Frameworkhttps://github.com/rs/SDWebImage#installation
Installation
There are two ways to use this in your project: copy all the files into your project, or import the project as a static library.Add the SDWebImage project to your project
Download and unzip the last version of the framework from the download pageRight-click on the project navigator and select "Add Files to "Your Project":
In the dialog, select SDWebImage.framework:
Check the "Copy items into destination group's folder (if needed)" checkbox
Add dependencies
In you application project app’s target settings, find the "Build Phases" section and open the "Link Binary With Libraries" block:Click the "+" button again and select the "ImageIO.framework", this is needed by the progressive download feature:
Add Linker Flag
Open the "Build Settings" tab, in the "Linking" section, locate the "Other Linker Flags" setting and add the "-ObjC" flag:Import headers in your source files
In the source files where you need to use the library, import the header file:#import <SDWebImage/UIImageView+WebCache.h>
Build Project
At this point your workspace should build without error. If you are having problem, post to the Issue and the community can help you solve it.3.使用
https://github.com/rs/SDWebImage#installation#import <SDWebImage/UIImageView+WebCache.h>...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:MyIdentifier] autorelease];
}
// Here we use the new provided setImageWithURL: method to load the web image
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
cell.textLabel.text = @"My Text";
return cell;
}
相关文章推荐
- iOS CATransition动画实现SDWebImage图片下载完成渐变动画
- iOS开发-SDWebImage4.0之后加载gif不显示的解决方案(FLAnimatedImageView FLAnimatedImage)
- iOS网络编程(三) 异步加载及缓存图片---->SDWebImage
- iOS开发-你真的会用SDWebImage?
- iOS三方—SDWebImage的使用
- IOS- SDWebImage的作用
- iOS客户端学习-SDWebImage
- iOS - SDWebImage的原理以及使用流程
- iOS SDwebimage清除缓存
- iOS网络——SDWebImage SDImageDownloader源码解析
- ios开发清除SDWebImage图片缓存
- iOS 用 SDWebImage 清理图片缓存
- iOS 下载缓存网络图片 SDWebImage
- IOS-SDWebImage 底层实现原理以及面试题相关问题的学习链接
- iOS_SDWebImage框架分析
- iOS基于SDWebimage和urlConnection简单的带进度条图片加载
- iOS:网络编程的第三方框架:AFNetworking、SDWebImage
- ios学习----------SDWebImage框架解析(3)
- iOS 迁移到HTTPS(自建证书+单向验证+AF3.0+WKWebView+SDWebImage)
- iOS开发-你真的会用SDWebImage?(转发)