开发者

iphone - not loading ~ipad image

开发者 https://www.devze.com 2023-01-05 23:47 出处:网络
I have 3 images on the same place on my app\'s bundle: \"image~iphone.png\", \"image@2x~iphone.png\" and \"image~ipad.png\".

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 imageNa开发者_开发知识库med:[[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.


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.


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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消