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)