11

I have an working application which i have tested in my ipod touch. Everything works pretty fine.

My tabbar icons and splash screen images are in a separate folder in my Resources folder

Resources->images

Now, I know for iPhone4 i need to use 2x images.

My question is for support for iPhone4 all that i need to do is add 2x images in my images folder. For example if my splashscreen image is Default.png, I should add my 2x image as Default@2x.png in my images folder and iphone will use it automatically.?

Is it the same for all tabbar images ?

Thanks in advance

Neelesh
  • 3,673
  • 8
  • 47
  • 78

2 Answers2

14

Yes, all that you said is correct. Remember to also import the @2x images into your Xcode project (e.g. by dragging them from Finder to Xcode), so they'll be added to the bundle when you build your app.

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
  • thanks for your reply. For my tabBar icon i have used an image "icon_tab_1_30x30.png" in my interface builder. Now i add "icon_tab_1_30x30@2x.png"..Should i change the naming in the interface builder like its said in the answer below ?? – Neelesh May 26 '11 at 10:25
  • @Narayanan: No. You don't need to change anything in Interface Builder. – BoltClock May 26 '11 at 10:26
9

For the apps I have worked on, I have only one image in this format:

myImage@2x.png

When I reference this image, I make the following call and it always works, whether on a 3GS/iPhone 4 or iPad.

[UIImage imageNamed:@"myImage.png"]
Luke
  • 11,426
  • 43
  • 60
  • 69
  • 6
    On non-Retina devices, if iOS can't find the standard images it will still look for the `@2x` versions and grab them. However, they get downsampled, and may not look right (or at least not look great). – BoltClock May 26 '11 at 10:21
  • you mean to say you dont have myImage.png at all ? – Neelesh May 26 '11 at 10:21
  • 1
    Correct - I only call the plain version (without @2x) but the only images referenced and linked to Xcode are the @2x versions. – Luke May 26 '11 at 10:23
  • 1
    and iphone downscales it automatically. wow. Thanks for the information. Should save binary file size :-) – Neelesh May 26 '11 at 10:26
  • It's an easy way to do indeed, but delivering the non-retina image makes the app more lightweight. – Warre Buysse Sep 01 '13 at 13:36