• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [iPhone] Caching images fetched from a URL?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [iPhone] Caching images fetched from a URL?


  • Subject: Re: [iPhone] Caching images fetched from a URL?
  • From: Eric Hermanson <email@hidden>
  • Date: Tue, 12 May 2009 17:19:48 -0400

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


  • Follow-Ups:
    • Re: [iPhone] Caching images fetched from a URL?
      • From: "Eric E. Dolecki" <email@hidden>
References: 
 >[iPhone] Caching images fetched from a URL? (From: "Eric E. Dolecki" <email@hidden>)
 >Re: [iPhone] Caching images fetched from a URL? (From: Dave DeLong <email@hidden>)
 >Re: [iPhone] Caching images fetched from a URL? (From: "Eric E. Dolecki" <email@hidden>)

  • Prev by Date: Re: Most efficient way of measuring text
  • Next by Date: Re: [iPhone] Caching images fetched from a URL?
  • Previous by thread: Re: [iPhone] Caching images fetched from a URL?
  • Next by thread: Re: [iPhone] Caching images fetched from a URL?
  • Index(es):
    • Date
    • Thread