On May 12, 2009, at 2:13 PM, Eric E. Dolecki wrote:

Okay, so I know I can somehow cache them... but I have some noob questions. - how do I cache the images themselves? Some binary data object written to
the disk? How?

If you're caching to memory, all you really need to do is retain the UIImage and keep a reference around so you can get to it later. To cache to the disk, you could encode your UIImage to NSData using NSKeyedArchiver, and then write to a file.


- how do I check if the image has already been loaded (check an
NSMutableArray populated with dictionaries with a url string and url key?)

I would have the following keys in my dictionary:
1. URLKey
2. MemoryCacheReferenceKey - this contains a reference to a UIImage in memory 3. FileReferenceKey - this contains a file path where the image can be cached on disk.


- if I find that the image has been cached (somehow), how do I use that
image instead?

Using the above dictionary scheme, I would first check if my MemoryCacheReferenceKey is valid. If so, I use that UIImage and be done. Otherwise, I would check for a file at the location in FileReferenceKey and use that if it exists. If I don't find anything in either of those caches, I would download the image using the URLKey.

Hope that helps.

Luke
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to