Re: [iPhone] Caching images fetched from a URL?
Re: [iPhone] Caching images fetched from a URL?
- Subject: Re: [iPhone] Caching images fetched from a URL?
- From: "Eric E. Dolecki" <email@hidden>
- Date: Wed, 13 May 2009 00:00:29 -0400
I like the cache without writing to the disk (for now anyway).
When you say the image object itself, I don't know exactly what you mean...
if it's just a pointer to UIImage then I think I do know. So I could pair
the pointer with the URL key, is that right?
E.
On Tue, May 12, 2009 at 5:19 PM, Eric Hermanson <email@hidden> wrote:
> Obviously, if you want to cache the images between runs of the application,
> you need to cache them as binary onto the disk. If you are OK with the
> images being loaded after every launch of the application, you can cache
> them into an NSMutableDictionary with the URL as the key, and the image
> object itself as the object (no need to convert it into binary if you're
> just going to store it in a dictionary). Just ask the dictionary for it's
> "objectForKey" by passing the URL. It will return 'nil' if it hasn't been
> cached yet (in which case you need to fetch the image and cache it). This
> is generally how all caches work.
>
> - Eric
>
>
> On May 12, 2009, at 5: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?
>> - how do I check if the image has already been loaded (check an
>> NSMutableArray populated with dictionaries with a url string and url key?)
>> - if I find that the image has been cached (somehow), how do I use that
>> image instead?
>>
>> On Tue, May 12, 2009 at 5:09 PM, Dave DeLong <email@hidden> wrote:
>>
>> Yes, if you cache them yourself.
>>>
>>> Dave
>>>
>>> On Tuesday, May 12, 2009, at 03:04PM, "Eric E. Dolecki" <
>>> email@hidden> wrote:
>>>
>>>> In my table, when a cell isn't nil I am setting UILabels, etc. However,
>>>> in
>>>> each cell I have a UIImageView... and the contents of each is an image
>>>> fetched from my server. No problem on initial display, but as soon as
>>>> you
>>>> start scrolling and the cells are reused, I am fetching new artwork...
>>>>
>>> which
>>>
>>>> makes the scrolling chug along.
>>>> Is there a way to cache these images, and if it was previously loaded to
>>>>
>>> use
>>>
>>>> that instead of loading from the url again?
>>>>
>>>> Thanks,
>>>> Eric
>>>>
>>>
>>>
>>
>>
>> --
>> http://ericd.net
>> Interactive design and development
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> 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:
>>
>> This email sent to email@hidden
>>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden
>
--
http://ericd.net
Interactive design and development
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden