iPhone 3或5S上的@ 3x图像或XIB中的5用于“用作启动图像”选项集 [英] @3x images incorrectly used on iPhone 6 or 5S or 5 in XIB's with the "Use as Launch Image" option set

查看:87
本文介绍了iPhone 3或5S上的@ 3x图像或XIB中的5用于“用作启动图像”选项集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

带着一个干净的全新iOS项目我已经:

With-in a clean brand new iOS project I've:


  • 在项目中添加了2张图片background@2x.png 和background@3x.png

  • 添加了一个名为LaunchScreen.xib的XIB

  • 检查了XIB的用作启动屏幕选项

  • 在LaunchScreen.xib中添加了一个UIView子视图,并在项目设置中使用-in将其图像名称设置为background.png

  • ,在目标常规设置下,我将启动屏幕文件设置为LaunchScreen

  • added 2 images to the project "background@2x.png" and "background@3x.png"
  • added a XIB named "LaunchScreen.xib"
  • checked the XIB's "Use as Launch Screen" option
  • added a UIView sub-view to LaunchScreen.xib and set its image name to "background.png"
  • with-in the project settings, under the targets 'General' settings I've set the 'Launch Screen file' to "LaunchScreen"

现在,当我启动应用程序时在@ 3x图像下方的任何设备列表中,当确定要使用@ 2x图像时,会在生成的启动屏幕中显示。

Now when I launch the app on any of the devices list below the @3x image is displayed in the resulting launch screen when surely the @2x image should be used.

问题设备(全部使用@ 3x资源):

Problem devices (that all use the @3x resource):


  • iPhone 5(iOS 8.0.0)

  • iPhone 6(iOS 8.0.0)

  • iPhone 6(iOS 8.0.2)

  • iPhone 5模拟器(iOS 8.0.0)

  • iPhone 6模拟器(iOS 8.0.0)

  • iPhone 5 (iOS 8.0.0)
  • iPhone 6 (iOS 8.0.0)
  • iPhone 6 (iOS 8.0.2)
  • iPhone 5 Simulator (iOS 8.0.0)
  • iPhone 6 Simulator (iOS 8.0.0)

请注意@ 2x图像与@ 3x图像不同,因此我可以轻松识别正在使用的图像。

NOTE that the @2x image is distinctive from the @3x image so I can easily identify which one is being used.

起初我假设这个是模拟器的一个错误,当它在真实设备上发生时也是错开的。

At first I assumed this was a bug with the simulator and was staggered when it occurred on a real device also.

我认为这是另一个iOS8错误但是我想也有可能它的预期行为作为启动画面的结果被缓存为某种静态图像。

I assume this is yet another iOS8 bug however I guess there's also the possibility that its expected behaviour as the result of the launch screen being cached as a static image of some kind.

任何想法或潜在的解决方案?

Any ideas or potential solutions?

编辑:

为了别人的利益,我后来发现如果将图像添加到Images.xcassets图像集中,则实际上观察到正确的行为。然而,这对我们来说不是一个理想的解决方案,因为我们有一个非常具体的图像导出过程,这意味着我们没有在项目中使用Images.xcassets(应用程序中有数千个图像)。

For the benefit of others, I have subsequently found that if the images are instead added to an Images.xcassets image set then the correct behaviour is in-fact observed. HOWEVER this is not an ideal solution for us since we have a very specific image export process which means we are not using an Images.xcassets in out project (there are thousands of images in the app).

我现在还用苹果公司筹集了雷达#18513968

I have now also raised a Radar with Apple #18513968

http://openradar.appspot.com/18513968

推荐答案

我刚才我自己试了一下,并得到了你提到的相同行为。

I've just tried this myself, and get the same behaviour you have mentioned.

通过将启动图像源设置为使用资产目录,并添加启动图像,您可以获得每个设备显示其具体背景。在这里可以看到一些截图:

By setting the Launch Images Source to "Use Asset Catalog", and adding the Launch Image you can get each device to show its specific background. Some screenshots can be seen here:

支持iPhone 6和iPhone 6+,具有适用于iPad纵向和横向的不同启动/启动屏幕图像

再看一下,我找到了一个提到的网站:

Looking into it a bit more, I found a website that mention:

http://oleb.net/blog/2014/08/replacing-launch-images-with-storyboards/


您可以使用Interface Builder中的新自适应UI功能使您的布局适合不同的屏幕尺寸。如果您的场景需要屏幕大小 - 特定图像,使用资产目录来定义每个尺寸类别的不同图像。

"You can use the new adaptive UI features in Interface Builder to fit your layout to different screen sizes. If your scene requires screen-size-specific images, use asset catalogs to define different images per size class."

也许这是唯一的方法。

这篇关于iPhone 3或5S上的@ 3x图像或XIB中的5用于“用作启动图像”选项集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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