问题描述
根据 this 的说法,在xcode 7中,这不是视网膜4选项故意将其删除.我确实编辑了Contents.json以将其取回,但效果不一样!我记得在XCode6/iOS9之前的版本中,iPhone 6将使用retina 4图片,因此我只需要为iPhone 4/4s设置一张全屏2x图片,为iPhone 5/5s和6设置一张全屏Retina4.
In xcode 7 these is no retina 4 option, according to this, apple removed it on purpose. I did edit Contents.json to get it back but the effect is not the same! I remember in XCode6/pre-iOS9 iPhone 6 will used retina 4 picture so I only need to set one fullscreen 2x picture for iPhone 4/4s, one fullscreen Retina 4 for iPhone 5/5s and 6.
我认为将Retina4用于iPhone 6确实有意义,而2x则没有意义!因为1334/750约为1.778,所以接近1136/640 = 1.775,而960/640 = 1.5.我的640 * 1136图片确实在iPhone 6上正确显示,而640 * 960图片却失真了.
I think using Retina4 for iPhone 6 really makes sense while 2x doesn't! Because 1334/750 is about 1.778, which is close to 1136/640 = 1.775 while 960/640 = 1.5. My 640*1136 pictures do show properly on iPhone 6 while 640*960 pictures are distorted.
但是,即使使用Xcode 7,即使我重新获得了retina 4选项,iPhone 6仍使用2x(640 * 960)图片而不是retina4图片(iPhone 5/5s确实使用了retina4并可以正常显示).我试图将设备类型从iPhone更改为Universal,同样.
But with Xcode 7 even I got the retina 4 option back, iPhone 6 still use 2x (640*960) picture instead of retina4 picture(iPhone 5/5s does use retina4 and shows properly now). I tried to change device type from iPhone to Universal, same.
所以我的问题是如果苹果有意移除了retina4,那么我如何在xasset中设置全屏图像以使其适用于iPhone 4/5/6 ?我只在谈论全屏图像.我了解使用2倍的非全屏图像是有道理的.
So my question is if apple removed retina4 on purpose then how do I set fullscreen images in xasset to make them work for iPhone 4/5/6 ? I am only talking about fullscreen images. I understand for non-fullscreen images using 2x makes sense.
顺便说一句,我不是在谈论AppIcon& LaunchImage(视网膜4仍然存在并且可以正常工作).我不想编写额外的代码来使其正常工作(实际上,这是我目前正在做的事情,例如带有资产目录的iPhone 6上的全屏图像).那么我可能只是设置资产以使其正常工作吗?
BTW I am not talking about AppIcon & LaunchImage (retina 4 is still there and works). I don't want to write extra code to make it work (actually this is what I currently do, like this Fullscreen images on iPhone 6 with Asset Catalogs) either. So is it possible that I just set asset to make it work ?
推荐答案
我向Apple技术支持人员提出了要求,他们确认目前尚无办法.我必须为此编写一些代码. 当前,资产目录无法加载设备特定的图像.如果您的应用需要支持设备特定的图像,则需要实现自己的代码以检测屏幕尺寸并选择适当的图像.您可以提交增强功能通过使用以下链接进行请求.请务必说明您使用此功能的用例."
I raised a ticket to apple technical support and they confirmed that currently there is no way to do that. I have to write some code for it. "Currently, there is no way for the Asset Catalog to load device specific images. If your app needs to support device specific images you will need to implement your own code to detect the screen size and choose the appropriate image. You can file an enhancement request by using the following link. Be sure to explain your use case for this feature. "
这篇关于xcode 7中没有Retina 4选项,那么我如何在资产中设置全屏图像以使其在4s/5s&中正确显示? iPhone 6?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!