1

我对 iOS 开发完全陌生。我想用 Sprite-Kit 框架做一个小游戏,我已经被 xcasset 目录困住了。

假设我的 iPhone 4s 有一个 320x320 像素的图像,其分辨率为 960x480 像素。我把它放在 xcasset 目录中的“iPhone 2x”上,对吧(cp.下图)?

在此处输入图像描述

现在,“iPhone 1x”需要 160x160,“iPhone 3x”需要 640x640 版本的图像吗?iPad 呢?就像素而言,“iPad 1x”和“iPad 2x”究竟是什么意思?在我的示例中,“iPad 1x”也是 320x320 和“iPad 2x”640x640 吗?

EDIT-1:感谢您提供可能重复的链接。但也没有讨论 iPad 版本的确切用途以及它们在像素方面的关系。

EDIT-2:尽管我使用 4096x4096 像素图像来生成启动图像(cp.下图),但使用 Asset Catalog Creator 调整大小的结果并不令人满意:

在此处输入图像描述

4

2 回答 2

1

It looks like your Sky image isn't set for "universal devices" which is why it's asking about iPad images. See Apple's Asset Catalog Help for more info about why you'd want device-specific images.

Select the Sky image name, then hit Command-Opt-4 to open the Attribute Inspector. Where it says "Devices" set it to "Universal" and you should just see the "Universal" section with the 1x, 2x, & 3x image wells.

Also, your sample image sizes seem off. If your @2x image (for iPhone 4s) is 960x480 then the 1x image would be 480 x 240. (and your 3x image for use on the iPhone 6+ would be 1440 x 960.) Your 1x image should be whatever point size you want, the 2x should be twice that in both dimensions, and the 3x should be three times the 1x in both dimensions.

于 2015-04-27T16:32:38.060 回答
0

我认为重要的是这些设备的不同显示密度:

 - iPhone 6 Plus                       401 ppi 
 - iPhone 6                            326 ppi 
 - iPhone 5, 5c, 5s, iPod touch        326 ppi
 - iPhone 4, 4s, iPod touch            326 ppi
 - iPad mini (2G/3G)                   326 ppi
 - iPad (3G/4G), iPad Air              264 ppi
 - iPhone 1, 2, 3                      163 ppi

因此导致1x (264 ppi)2x (326 ppi)3x (401 ppi)与实际屏幕尺寸(以像素为单位)无关。

于 2015-04-26T13:13:46.417 回答