我正在使用 setImageWithURL 在我的应用中下载一些图片。是否有可能:
I'm using setImageWithURL to download some images in my app. Is it possible:
文档在这些方面并不是很清楚..
The documentation is not really clear on these points..
推荐答案UIImageView 类别使用内部短暂缓存在 UITableView 等内容中实现高性能。对于长期缓存,请使用系统级缓存系统 - 即Peter Steinberger的 SDURLCache 的分支, NSURLCache 。
The UIImageView category uses an internal, ephemeral cache for high performance in things like UITableView. For longer-term cache, use the system-level cacheing system--namely Peter Steinberger's fork of SDURLCache, a subclass of NSURLCache.
使用应用程序委托中的以下代码进行设置 applicationDidFinishLaunching:withOptions::
Set it up with the following code in the application delegate applicationDidFinishLaunching:withOptions::
SDURLCache *URLCache = [[SDURLCache alloc] initWithMemoryCapacity:1024*1024*2 diskCapacity:1024*1024*20 diskPath:[SDURLCache defaultCachePath]]; [URLCache setIgnoreMemoryOnlyStoragePolicy:YES]; [NSURLCache setSharedURLCache:URLCache]; [URLCache release];更多推荐
使用AFNetworking的setImageWithURL时如何配置缓存
发布评论