Web Image
=========
[![Build Status](http://img.shields.io/travis/rs/SDWebImage/master.svg?style=flat)](https://travis-ci.org/rs/SDWebImage)
[![Pod Version](http://img.shields.io/cocoapods/v/SDWebImage.svg?style=flat)](http://cocoadocs.org/docsets/SDWebImage/)
[![Pod Platform](http://img.shields.io/cocoapods/p/SDWebImage.svg?style=flat)](http://cocoadocs.org/docsets/SDWebImage/)
[![Pod License](http://img.shields.io/cocoapods/l/SDWebImage.svg?style=flat)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![Dependency Status](https://www.versioneye.com/objective-c/sdwebimage/3.3/badge.svg?style=flat)](https://www.versioneye.com/objective-c/sdwebimage/3.3)
[![Reference Status](https://www.versioneye.com/objective-c/sdwebimage/reference_badge.svg?style=flat)](https://www.versioneye.com/objective-c/sdwebimage/references)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/rs/SDWebImage)
This library provides a category for UIImageView with support for remote images coming from the web.
It provides:
- An `UIImageView` category adding web image and cache management to the Cocoa Touch framework
- An asynchronous image downloader
- An asynchronous memory + disk image caching with automatic cache expiration handling
- Animated GIF support
- WebP format support
- A background image decompression
- A guarantee that the same URL won't be downloaded several times
- A guarantee that bogus URLs won't be retried again and again
- A guarantee that main thread will never be blocked
- Performances!
- Use GCD and ARC
- Arm64 support
NOTE: The version 3.0 of SDWebImage isn't fully backward compatible with 2.0 and requires iOS 5.1.1
minimum deployment version. If you need iOS < 5.0 support, please use the last [2.0 version](https://github.com/rs/SDWebImage/tree/2.0-compat).
[How is SDWebImage better than X?](https://github.com/rs/SDWebImage/wiki/How-is-SDWebImage-better-than-X%3F)
Who Uses It
----------
Find out [who uses SDWebImage](https://github.com/rs/SDWebImage/wiki/Who-Uses-SDWebImage) and add your app to the list.
How To Use
----------
API documentation is available at [CocoaDocs - SDWebImage](http://cocoadocs.org/docsets/SDWebImage/)
### Using UIImageView+WebCache category with UITableView
Just #import the UIImageView+WebCache.h header, and call the sd_setImageWithURL:placeholderImage:
method from the tableView:cellForRowAtIndexPath: UITableViewDataSource method. Everything will be
handled for you, from async downloads to caching management.
```objective-c
#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 sd_setImageWithURL: method to load the web image
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]];
cell.textLabel.text = @"My Text";
return cell;
}
```
### Using blocks
With blocks, you can be notified about the image download progress and whenever the image retrieval
has completed with success or not:
```objective-c
// Here we use the new provided sd_setImageWithURL: method to load the web image
[cell.imageView sd_setImageWithURL:[NSURL URLWithString:@"http://www.domain.com/path/to/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
... completion code here ...
}];
```
Note: neither your success nor failure block will be call if your image request is canceled before completion.
### Using SDWebImageManager
The SDWebImageManager is the class behind the UIImageView+WebCache category. It ties the
asynchronous downloader with the image cache store. You can use this class directly to benefit
from web image downloading with caching in another context than a UIView (ie: with Cocoa).
Here is a simple example of how to use SDWebImageManager:
```objective-c
SDWebImageManager *manager = [SDWebImageManager sharedManager];
[manager downloadImageWithURL:imageURL
options:0
progress:^(NSInteger receivedSize, NSInteger expectedSize) {
// progression tracking code
}
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
if (image) {
// do something with image
}
}];
```
### Using Asynchronous Image Downloader Independently
It's also possible to use the async image downloader independently:
```objective-c
SDWebImageDownloader *downloader = [SDWebImageDownloader sharedDownloader];
[downloader downloadImageWithURL:imageURL
options:0
progress:^(NSInteger receivedSize, NSInteger expectedSize) {
// progression tracking code
}
completed:^(UIImage *image, NSData *data, NSError *error, BOOL finished) {
if (image && finished) {
// do something with image
}
}];
```
### Using Asynchronous Image Caching Independently
It is also possible to use the async based image cache store independently. SDImageCache
maintains a memory cache and an optional disk cache. Disk cache write operations are performed
asynchronous so it doesn't add unnecessary latency to the UI.
The SDImageCache class provides a singleton instance for convenience but you can create your own
instance if you want to create separated cache namespace.
To lookup the cache, you use the `queryDiskCacheForKey:done:` method. If the method returns nil, it means the cache
doesn't currently own the image. You are thus responsible for generating and caching it. The cache
key is an application unique identifier for the image to cache. It is generally the absolute URL of
the image.
```objective-c
SDImageCache *imageCache = [[SDImageCache alloc] initWithNamespace:@"myNamespace"];
[imageCache queryDiskCacheForKey:myCacheKey done:^(UIImage *image) {
// image is not nil if image was found
}];
```
By default SDImageCache will lookup the disk cache if an image can't be found in the memory cache.
You can prevent this from happening by calling the alternative method `imageFromMemoryCacheForKey:`.
To store an image into the cache, you use the storeImage:forKey: method:
```objective-c
[[SDImageCache sharedImageCache] storeImage:myImage forKey:myCacheKey];
```
By default, the image will be stored in memory cache as well as on disk cache (asynchronously). If
you want only the memory cache, use the alternative method storeImage:forKey:toDisk: with a negative
third argument.
### Using cache key filter
Sometime, you may not want to use the image URL as cache key because part of the URL is dynamic
(i.e.: for access control purpose). SDWebImageManager provides a way to set a cache key filter that
takes the NSURL as input, and output a cache key NSString.
The following example sets a filter in the application delegate that will remove any query-string from
the URL before to use it as a cache key:
```objective-c
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
SDWebImageManager.shar
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
iOS自定义交互式转场动画-仿微信图片浏览器转场动画、仿iOS系统相册图片浏览转场动画、仿酷狗转场动画 + 交互式图片浏览 软件开发设计:PHP、QT、应用软件开发、系统软件开发、移动应用开发、网站开发C++、Java、python、web、C#等语言的项目开发与学习资料 硬件与设备:单片机、EDA、proteus、RTOS、包括计算机硬件、服务器、网络设备、存储设备、移动设备等 操作系统:LInux、IOS、树莓派、安卓开发、微机操作系统、网络操作系统、分布式操作系统等。此外,还有嵌入式操作系统、智能操作系统等。 网络与通信:数据传输、信号处理、网络协议、网络与通信硬件、网络安全网络与通信是一个非常广泛的领域,它涉及到计算机科学、电子工程、数学等多个学科的知识。 云计算与大数据:数据集、包括云计算平台、大数据分析、人工智能、机器学习等,云计算是一种基于互联网的计算方式,通过这种方式,共享的软硬件资源和信息可以按需提供给计算机和其他设备。
资源推荐
资源详情
资源评论
收起资源包目录
iOS自定义交互式转场动画-仿微信图片浏览器转场动画.zip (267个子文件)
.DS_Store 10KB
.DS_Store 8KB
.DS_Store 8KB
.DS_Store 8KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
.DS_Store 6KB
效果展示.gif 5.24MB
图片浏览器.gif 2.28MB
Expression14.gif 165KB
Expression09.gif 31KB
.gitignore 228B
UIButton+WebCache.h 13KB
SDWebImageManager.h 11KB
UIImageView+WebCache.h 10KB
SDImageCache.h 9KB
SDWebImageDownloader.h 7KB
UIImageView+HighlightedWebCache.h 5KB
SDWebImagePrefetcher.h 4KB
SDWebImageDownloaderOperation.h 3KB
SDWebImageCompat.h 2KB
LYPictureBrowseTransitionParameter.h 2KB
UIView+WebCacheOperation.h 970B
LYModalWeChatInteractiveAnimatedTransition.h 919B
LYNavWeChatInteractiveAnimatedTransition.h 909B
SDWebImage-umbrella.h 802B
LYPictureBrowserCell.h 786B
LYPictureBrowseViewController.h 713B
LYQuestionTwoPushAnimator.h 660B
LYModalWeChatPercentDrivenInteractive.h 651B
LYNavWeChatPercentDrivenInteractive.h 647B
LYQuestionTwoAnimationTransition.h 634B
LYQuestionTwoPopAnimator.h 632B
LYQuestionOneCell.h 618B
LYModal-WeChat-AnimationTransition.h 585B
LYQuestionsOneAnimationTrasition.h 574B
LYNavWeChatAnimationTransition.h 570B
LYNavWeChatPushAnimator.h 569B
NSData+ImageContentType.h 565B
LYQuestionsOnePushAnimator.h 558B
LYQuestionsOnePopAnimator.h 556B
LYNavWeChatInteractivePushAnimator.h 540B
LYNavWeChatInteractivePopAnimator.h 539B
LYPictureBrowsePopAnimator.h 537B
LYNavWeChatPopAnimator.h 516B
LYBrowseZoomScrollView.h 484B
SDWebImageDecoder.h 453B
LYPictureBrowseInteractiveAnimatedTransition.h 450B
LYPictureBrowsePercentDrivenInteractive.h 441B
LYPictureBrowse.h 419B
LYPictureBrowsePushAnimator.h 414B
LYPictureBrowseSouceModel.h 405B
LYNavBaseInteractiveAnimatedTransition.h 404B
LYModalKuGouInteractiveAnimatedTransition.h 383B
UIImage+GIF.h 382B
LYModalKuGouPercentDerivenInteractive.h 379B
LYNavKuGouPercentDerivenInteractive.h 374B
LYNavKuGouInteractiveAnimatedTransition.h 372B
LYNavBasePercentDerivenInteractive.h 371B
Pods-LYCustomTransitionDemo-umbrella.h 346B
LYModalWeChatInteractiveSecondVC.h 345B
LYNavWeChatInteractiveSecondVC.h 343B
LYQuestionsOneSecondVC.h 334B
SDWebImageOperation.h 329B
LYModalKuGouAnimationTransition.h 324B
LYNavKuGouAnimationTransition.h 319B
LYNavKuGouPushAnimator.h 313B
LYNavKuGouPopAnimator.h 310B
LYNavBaseCustomAnimator.h 306B
LYPictureFirstPageCell.h 299B
AppDelegate.h 288B
UIViewController+hook.h 266B
UIImage+MultiFormat.h 263B
LYModalKuGouInteractiveSecondVC.h 258B
LYNavKuGouInteractiveSecondVC.h 254B
LYNavBaseInteractiveSecondVC.h 252B
LYModalCATransitionSecondVC.h 250B
LYModalWeChatInteractiveVC.h 248B
LYModalCATransitionFirstVC.h 248B
LYModalKuGouInteractiveVC.h 246B
LYNavWeChatInteractiveVC.h 244B
LYNavCATransitionFirstVC.h 244B
LYNavCATransitionSecondVC.h 243B
LYNavKuGouInteractiveVC.h 242B
LYCustomTransitonHomeVC.h 242B
LYModal-WeChatSecondVC.h 240B
LYNavBaseInteractiveVC.h 240B
LYNavKugouSecondVC.h 239B
LYQuestionTwoSecondVC.h 238B
LYQuestionsOneFirstVC.h 238B
LYModalKuGouSecondVC.h 236B
LYQuestionTwoFirstVC.h 236B
LYModalBaseSecondVC.h 234B
LYNavWeChatSecondVC.h 234B
LYNavBaseSecondVC.h 230B
LYPictureFirstVC.h 228B
共 267 条
- 1
- 2
- 3
资源评论
妄北y
- 粉丝: 9668
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功