SimplyKiwi
SimplyKiwi

Reputation: 12444

iPad Retina Images not showing?

In my application, I am having trouble showing iPad Retina images. I know I have to use the @2x~ipad.png extension in order to get them to properly show and I do that. My images are named according so they are all named the same besides the extension for each device. However, my images appear blurry when viewing them on an iPad 3. I know the images are the proper size and PPI but it just doesn't look clear.

My images are in my 'Copy Bundle Resources' too. I have tried to clean my project, and restart Xcode. No luck.

Also in Interace Builder in my iPad XIB, I have each image set to the -72.png image (I guess the image automatically switches to the @2x~ipad.png if it is an iPad 3 correct?)

Is there any way to confirm maybe via NSLogs to see if it is loading the correct images? Also is there anything else I should double check to ensure that the proper images are loaded.

Upvotes: 2

Views: 2444

Answers (2)

David Hoerl
David Hoerl

Reputation: 41662

Uh, if you really are doing this:

[name]-72.png and [name]@2x~ipad.png

thats not right.

If this is a universal app, then you have

  • Foo.png (or Foo~iphone.png) and [email protected] (or Foo@2x~iphone.png) [NOTE: iphone not iPhone];

  • Foo~ipad.png and Foo@2x~ipad.png

This all working for me in my universal app.

EDIT: you can read about the naming convention in Apple's "Resource Programming Guide", page 46:

The bundle- and image-loading routines automatically look for image files with the @2x string when the underlying device has a high-resolution screen. If you combine the @2x string with other modifiers, the @2x string should come before any device modifiers but after all other modifiers, such as launch orientation or URL scheme modifiers. For example:

  • MyImage.png - Default version of an image resource.

  • [email protected] - High-resolution version of an image resource for devices with Retina displays.

  • MyImage~iphone.png - Version of an image for iPhone and iPod touch.

  • MyImage@2x~iphone.png - High-resolution version of an image for iPhone and iPod touch devices with Retina displays.

EDIT2: So I did trip on a reference to "-72" (and -50). These were used in iOS 3.1.3 and older. The full explanation is found "iOS Application Programming Guide", "App Icon" section (links too fragile to use).

Upvotes: 8

Mazyod
Mazyod

Reputation: 22569

What I am doing is setting the image names to:

  1. [name]_ipad.png, [name][email protected]. [iPad]
  2. [name]_ipod.png, [name][email protected]. [iPhone]

And, I added a category on UIImage, mc_imageNamed: that appends the _ipad or _ipod based on the current device. And of course I have set the images based on their names in the XIBs.

This method is guaranteed to work, from my experience. It would be great if someone would fix your issue, but this solution is also available.

Upvotes: 0

Related Questions