通用应用iPad / iPhone图像命名约定? [英] Universal application iPad/iPhone image naming convention?

查看:119
本文介绍了通用应用iPad / iPhone图像命名约定?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我需要根据设备iPad / iPhone 4 / iPhone 3设备获取正确的图像。

In my application I need to get the correct image based on the device iPad/iPhone 4/iPhone 3 device.

例如:

我有一张名为 a.png 的图像(宽度40,高度20),适用于iPhone 3 / iPod,以及适用于iPhone 4的a@2x.png (宽度80,高度40)。

I have an image named a.png (width 40,height 20) for iPhone 3/iPod, and a@2x.png (width 80,height 40) for iPhone 4.

如果我提到代码

UIImage *myImage=[UIImage imageNamed:@"a.png"];

myImage包含(80 * 40)图像,如果是iPhone 4.
myImage包含(40 * 20)图像,如果它是iPod / iPhone 3。

myImage contains (80*40) image if it's iPhone 4. myImage contains (40*20) image if it's iPod/iPhone 3.

我的问题是如何获得iPad(60 * 30)的图像,如上面的命名约定。

My question is how do I get the image for iPad (60*30) like above naming convention.

我尝试将 a~ipo.png 作为图像名称,但它无效。你能指出哪里有错误吗?

I tried giving a~ipad.png as an image name and it's not working. Can you point out where there is a mistake?

如果我使用 [UIDevice currentDevice]; isIpod - > load(60 * 30)image
否则为iPhone / iPod加载图像它工作正常。

And if I use the condition using [UIDevice currentDevice]; isIpod -> load(60*30) image otherwise load images for iPhone/iPod it's working fine.

但我需要让它无需使用条件,并为iPhone / iPod使用 a.png 等命名约定, a。@ 2x.png for iPhone 4和iPad同样适用。

But I need to get it to work without using the condition, and using the naming convention like a.png for iPhone/iPod, a.@2x.png for iPhone 4 and likewise for iPad.

提前致谢。

推荐答案

我知道这是旧帖子,但我认为截图给出了更明确的命名约定。

I know it is old post, but I think Screenshot gives more clear idea about naming convention.

使用最新设备: button@3x~iphone.png button@3x~ipad.png

这篇关于通用应用iPad / iPhone图像命名约定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆