开发者

Cocoa Touch - How to cache a CGImageRef or UIImage (not using imageNamed:)?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜