6

我正在使用包含以下两种图像的资产目录:2x、Retina 4 2x 和 3x。所有这些文件都用于正确的设备 iPhone 4, 4s => 2x, iPhone 5, 5s => Retina 4 2x, iPhone 6+ => 3x ,但 iPhone 6 使用 2x 而不是 Retina 4 2x。有没有人遇到过这个问题?

谢谢

[编辑文本] 图像集是一般图像,而不是启动屏幕。无论我使用通用设置还是设备设置,无论我选择 2x Retina 4 是 1334 还是 1136,iPhone 6 上呈现的图像都是常规 2x 之一。

我正在添加我选择的三种不同设置的屏幕截图,对于所有这三种设置,结果都是附加模拟器的屏幕截图

---------------模拟器屏幕截图(iPhone 6): ---------------

模拟器

---------------包含 568 的设备的设置屏幕截图: ---------------

568设备

---------------包含 667 的设备的设置屏幕截图---------------

667设备

--------------- Universal 设置的屏幕截图--------------- 普遍的

---------------图像集设置的屏幕截图(设备设置和 667 高度图像) --------------- 在此处输入图像描述

---------------发射台的屏幕截图---------------- 在此处输入图像描述

4

3 回答 3

3

From what I can tell, it seems you want to display a full screen image in native resolution.

Yeah I think this might be a known issue. I don't think you can do it with an asset catalog. I ended up doing it like this guy here: https://stackoverflow.com/q/25892207/342756

My app is landscape, mnd my background image which fills the entire screen in native res I just call like this:

[UIImage imageForDeviceWithName:@"myBackground"];

And here is the list of files and resolutions for "myBackground" (again landscape):

  • myBackground@2x.png == 960 × 640
  • myBackground-568h@2x.png == 1136 × 640
  • myBackground-667h@2x.png == 1334 × 750
  • myBackground@3x.png == 2208 × 1242
  • myBackground~ipad.png == 1024 × 768
  • myBackground@2x~ipad.png == 2048 × 1536

I no longer support 1x. This pretty much covers all iOS 7 and iOS 8 devices. Hope this helps.

Cheers!

于 2014-12-15T12:22:21.583 回答
1

这适用于 Xcode v7.3 并在运行 iOS v9.3 的 iPhone 4s 模拟器中验证。

为了避免缩放问题,我做了以下事情:

在我的 Images.xcassets 中,我创建了两个图像集:
intro_screen
intro_screen_4

在 intro_screen 我包括以下图像
1x 320x480
2x 750x1334
3x 1242x2208

在 intro_screen_4 我只包含了 iPhone 4
2x 640x960的图像

在我的代码中,我执行了以下操作:

int screenHeight = [ [ UIScreen mainScreen ] bounds ].size.height;

if(screenHeight == 480)
{
    image = [UIImage imageNamed:@"intro_screen_4" ];
}
else {
    image = [UIImage imageNamed:@"intro_screen" ];
}
于 2016-09-09T23:35:31.023 回答
0

我相信这是资产目录中特定于设备的设置的一个已知问题。请改用通用设置(1x、2x 和 3x)。iPhone 5、5s 和 6 都将使用 2x,一切都会好起来的。

于 2014-11-02T19:04:50.873 回答