简体   繁体   English

如何根据尺寸类别在启动屏幕中显示不同的图像

[英]How to display different images in launch screen depending on size classes

I have a LaunchScreen.xib that needs to show slightly different logos for different device formats. 我有一个LaunchScreen.xib,需要针对不同的设备格式显示稍有不同的徽标。 I understand how to set constraints conditionally using the "Vary for Traits" button, but I also need to replace the actual image set that the UIImageView is using. 我了解如何使用“为特征而异”按钮有条件地设置约束,但是我还需要替换UIImageView使用的实际图像集。 I know there is some kind of workaround because I have a sample file where this is happening, but I don't know how they achieved it (see the grayed-out images in the screenshot). 我知道有一种解决方法,因为我有一个发生这种情况的示例文件,但我不知道他们是如何实现的(请参阅屏幕快照中的灰色图像)。 I cannot use code because this is a launch screen, so any solution needs to be possible with interface builder. 我不能使用代码,因为这是一个启动屏幕,因此任何解决方案都需要使用Interface Builder才能实现。

Conditional image use that I would like to replicate 我想复制的条件图像使用

在此处输入图片说明

You can have different images for iPhone and iPad (watch, TV) in your asset catalog for one resource. 对于一种资源,资产目录中可以为iPhone和iPad(手表,电视)提供不同的图像。

在此处输入图片说明

You can also have different image for different width, height (traits based) and gamut that you specify in the Image drop down in the LaunchScreen.storyboard (see the little plus sign). 您还可以在LaunchScreen.storyboard的“图像”下拉列表中为不同的宽度,高度(基于特征)和色域指定不同的图像(请参阅小加号)。

在此处输入图片说明

I think the latter is what you want. 我认为后者就是您想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM