Day 118 – Make my first iPhone app in 16 weeks (imageNamed vs. imageWithContentsOfFile)

This is part of “Make my first iPhone app in 16 weeks” series.

imageNamed vs. imageWithContentsOfFile

  • imageNamed decompresses the image immediately
  • imageNamed cached by OS (perfect for frequently used images)
  • imageNamed is used by iOS to load nib referenced images (images referenced in nib or storyboard)
  • imageWithContentsOfFile decompresses the image on demand (lazily loaded when it displays on the screen)
  • imageWithContentsOfFile is NOT cached by OS (perfect for infrequently used images so that there is no cache pressure)


Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>