Berendschot
Berendschot

Reputation: 3104

iPad sized images in XCode

I'm currently working on a universal iOS app. But my iPad is taking the '@2x version' of each image. I've read something about adding "~iPad" to the filename, this works perfect on the simulator but not on my (real) iPad.

Don't know what I'm doing wrong:

iPhone (non-retina) image.png

iPhone (retina) image@2x~iPhone.png (this is the one that my iPad choses)

iPad (non-retina) image~iPad.png (instead of this one)

iPad (retina) image@2x~iPad.png

Upvotes: 1

Views: 705

Answers (2)

Berendschot
Berendschot

Reputation: 3104

I cleaned my build folder, re-added my images and now everything is working fine.

Here is to everyone with the same question a message: As @Craig Otis mentioned, the difference between a capital and a non capital character is very important. Watch this image to understand the image-naming: https://stackoverflow.com/a/18574780/2246164

Upvotes: 0

Craig Otis
Craig Otis

Reputation: 32054

In the Resource Programming Guide here:

https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/LoadingResources/Introduction/Introduction.html

In the section titled iOS Supports Device-Specific Resources (emphasis mine):

The 'device' string is a case-sensitive string that can be one of the following values:

  1. ~ipad - The resource should be loaded on iPad devices only.
  2. ~iphone - The resource should be loaded on iPhone or iPod touch devices only.

So instead of:

image~iPad.png

You should use:

image~ipad.png

Upvotes: 2

Related Questions