GDRSImageCache iOS 图片缓存库

程序名称:GDRSImageCache

授权协议: MIT/X

操作系统: iOS

开发语言: Objective-C

GDRSImageCache 介绍

GDRSImageCache 是 iOS 一个非常小型的图片缓存和更改图片大小的开发包。给定一个 URL 后该库会通过后台线程获取图片并在内存中缓存。

使用方法:

UIImageView *anImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];

// create the cache
GDRSImageCache *cache = [[GDRSImageCache alloc] initWithCachedImageFilter:^UIImage *(UIImage *sourceImage) {

    // resize the image to the image view size and round the image corners; 
    // this is called by the cache on a background thread
    return [sourceImage gdrs_resizedImageToAspectFitSize:anImageView.bounds.size cornerRadius:10];

}];

// set the default image, which will be returned from
// fetchImageWithURL:completionHandler: if an image coresponding to the
// requested url is not cached yet.
cache.defaultImage = [UIImage imageNamed:<#place holder image name#>];


NSURL *imageUrl = <#an url to a image#>;

// fetch an image; the call returns imidiatly and the callback handler
// is called when the image is fetched over the network
anImageView.image = [cache fetchImageWithURL:imageUrl completionHandler:^(UIImage *image, NSError *error) {
    anImageView.image = image;
}];

GDRSImageCache 官网

https://github.com/gabrielar/GDRSImageCache

相关编程语言

Acapela TTS 是一个为 iPhone 和 iPad 开发的 TTS 引...
二维码(QR Code)扫描静态库,扫描效率较高。
RegexKitLite 是一个轻量级的 Objective-C 的正则表...
一款基于ASIHttpReques开源的仿迅雷多线程断点续传功...
实现动态检测网络(wifi)状况,不需要用户手动刷新...
使用iphoneSDK官方NSXMLParserDelegate做的简单xml解...