iphone - not loading ~ipad image
Asked Answered
B

4

1

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.

Body answered 5/7, 2010 at 20:56 Comment(2)
Why not just use UIImage *imageU = [UIImage imageNamed:@"image.png"];?Gutenberg
good question. This is not working in my project. I have to give the full path.Body
B
1

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.

Body answered 6/7, 2010 at 7:9 Comment(0)
S
0

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?

Sodamide answered 5/7, 2010 at 21:21 Comment(1)
yes. Checked them out again now. All perfectly assigned to the correct target.Body
P
0

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.

Petepetechia answered 6/7, 2010 at 17:41 Comment(1)
how is this related? is is talking about [UIImage imageNamed:], not launch images.Cottonmouth
L
-1

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.

Liponis answered 10/9, 2012 at 5:17 Comment(1)
Isn't he saying in his question exactly that it doesn't work for him?Accompanyist

© 2022 - 2024 — McMap. All rights reserved.