views:

260

answers:

1

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 them fast so my question is:

How to cache CGImageRef, or cache the UIImage derived from it later on in the main thread?

A: 

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.

corprew