1
votes

I have 3 images on the same place on my app's bundle: "image~iphone.png", "image@2x~iphone.png" and "image~ipad.png".

when I do

UIImage *imageU = [UIImage imageNamed:[[NSBundle mainBundle]  pathForResource:@"image"
ofType:@"png"]];

BOth, the iPhone and iPhone 4 hires versions load fine, but not the ipad image. When I run on iPad, I get nil on imageU.

Yes, the image is there, the name is correct (iphone~ipad.png).

Why is that? any clues?

thanks.

4
Why not just use UIImage *imageU = [UIImage imageNamed:@"image.png"];?kennytm
good question. This is not working in my project. I have to give the full path.Duck

4 Answers

1
votes

I discovered that the solution for that is: do not use any extension on the iPad images. This tilde trick is not working for iPad. One more buggy stuff that makes us waste time.

0
votes

Possible daft attempt, but is the ipad image copied into the correct target when you add it as a resource? By that, I mean - of you right click the image and get info, does it have the iPad ticked as it's target?

0
votes

I ran into the same problem with launch images. Despite what the docs say, naming a file with a ~ipad suffix doesn't do anything. You need to set the UILaunchImageFile~ipad key and use a separate name for your launch images on iPad, e.g., DefaultiPad.png and DefaultiPad-Landscape.png, then make sure to just set UILaunchImageFile~ipad to DefaultiPad (no .png suffix) and it will pick up the variants correctly.

-1
votes

image "image~ipad.png" will show HD quality on iPad because in ios 5.1 "~ipad.png" is used to show HD quality image of resolution 2048*2048.Test this naming conservation on iPad,it will work.