The UIImageView category uses an internal ephemeral cache for high performance in things like UITableView . For a longer-term cache, use a system-wide cache system, namely Peter Steinberger’s plug SDURLCache , a subclass of NSURLCache .
Define it using 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];
mattt
source share