I have a lot of images in my app so I decided to do some loading in a background thread, and since UIKit isn't thread-safe, I filled arrays with CGImageRefs. However, they are not cached and I need to be able to access the开发者_高级运维m fast so my question is:
How to cache CGImageRef, or cache the UIImage derived from it later on in the main thread?
The UIImageView+Cached code found here implements a simple cache of UIImages combined with background loading in a thread.
I use this in my own projects. It works well. I recommend it. It should be easily adaptable to do what you want and a quick look says that pulling out the caching bits should be easy.
精彩评论