简体   繁体   English

在iOS中启动多个设备和不同方向的屏幕故事板

[英]Launch screen storyboard for multiple devices and different orientations in iOS

My application supports all devices from 4 inch onwards in both orientations. 我的应用程序支持从两个方向的4英寸以上的所有设备。

iPhone - 5, 5S, 5C, 6, 6S, 6+, 6S+, SE iPhone - 5,5S,5C,6,6S,6 +,6S +,SE

iPad 4, iPad Air, iPad Air2, iPad Pro etc iPad 4,iPad Air,iPad Air2,iPad Pro等

Using asset catalog for launch screen its working fine but in iPad Pro app displays standard keyboard rather iPad Pro optimized keyboard which is bigger and doesn't give best user feel. 使用资产目录启动屏幕它的工作正常,但在iPad Pro应用程序显示标准键盘,而iPad Pro优化键盘更大,并没有给用户最好的感觉。

As per below link app should be using launch storyboard rather than asset images to get optimized iPad Pro native keyboard. 如下所示链接应用程序应该使用启动故事板而不是资产图像来获得优化的iPad Pro原生键盘。

https://forums.developer.apple.com/thread/26357 https://forums.developer.apple.com/thread/26357

Now question is how to support both orientations during launch screen storyboard ? 现在的问题是如何在发布屏幕故事板中支持两种方向?

How to add different launch images for portrait and landscape modes in storyboard ? 如何在故事板中为纵向和横向模式添加不同的启动图像? Using size class for iPad in both orientations its both Regular and Regular size. 在两个方向上使用iPad的尺寸等级,包括常规和常规尺寸。

Note - Because it launches a screen storyboard, one can't customize the size class with custom class. 注 - 由于它启动了屏幕故事板,因此无法使用自定义类自定义大小类。

In your launchsScreen.storyboard add imageView and set it's four constraints like : top,bottom,leading,trailing . 在您的launchsScreen.storyboard添加imageView ,并设置它的四大制约因素,如: top,bottom,leading,trailing

Now, in your assets add separate images for iPhone and iPad with 1x,2x,3x resolution for iPhone and 1x,2x for iPad . 现在,在您的assetsiPhoneiPad添加单独的图像1x,2x,3x分辨率为1x,2x,3x适用于iPhone1x,2x适用于iPad

And set that image to that imageview. 并将该图像设置为该imageview。 It will manage then for every device! 它将管理每个设备!

You can set different images for different size class in assets. 您可以为资产中的不同大小类设置不同的图像。 So for different orientation you can set different images in assets . 所以对于不同的方向,您可以在assets设置不同的图像

refer Apple documentation for more details. 有关详细信息,请参阅Apple文档

And yes you can use vector graphics as suggested in comment by @pkc456 to keep your app light weight. 是的,您可以使用@ pkc456评论中建议的矢量图形来保持您的应用轻量级。

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

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