简体   繁体   English

启动纵向和横向vs分屏的screen.storyboard

[英]Launch screen.storyboard for Portrait and Landscape vs split screen

I have to implement split screen functionality for the new iPad and I got a workaround from Apple's doc to support the same in my app: https://developer.apple.com/library/prerelease/ios/documentation/WindowsViews/Conceptual/AdoptingMultitaskingOniPad/QuickStartForSlideOverAndSplitView.html#//apple_ref/doc/uid/TP40015145-CH13-SW1 我必须为新iPad实现分屏功能,我从Apple的doc获得了一个解决方法,以支持我的应用程序: https//developer.apple.com/library/prerelease/ios/documentation/WindowsViews/Conceptual/AdoptingMultitaskingOniPad /QuickStartForSlideOverAndSplitView.html#//apple_ref/doc/uid/TP40015145-CH13-SW1

In this doc, check the 2nd point: 在本文档中,请检查第2点:

Provide a LaunchScreen.storyboard file (instead of a .png image file as you did in iOS 7 and earlier) 提供LaunchScreen.storyboard文件(而不是像iOS 7及更早版本中那样的.png图像文件)

This is why I have to use Launch screen.storyboard. 这就是我必须使用Launch screen.storyboard的原因。 Now, the split over works perfect but for my app I have separate Launch screens, Default-Portrait and Default-Landscape. 现在,拆分工作完美,但对于我的应用程序,我有单独的启动屏幕,默认纵向和默认景观。 But now I have taken storyboard, I am unable to customise launch screens for different orientations. 但是现在我已经采用了故事板,我无法为不同的方向定制启动屏幕。 And even I can't code for the same in Launch screen or it gives me error. 甚至我无法在Launch屏幕中编写相同的代码,否则它会给我错误。

Further, I have tried using size classes to provide separate imageviews for both orientations but I got no success. 此外,我尝试使用大小类为两个方向提供单独的图像视图,但我没有成功。

It would be great help if anyone suggests me how to implement Launch screen.storyboard for Landscape and Portrait with different images. 如果有人建议我如何使用不同的图像实现风景和肖像的Launch screen.storyboard,那将是很有帮助的。

景观 肖像

You can add a UIImage to your launch screen. 您可以在启动屏幕上添加UIImage。 Once you've done that and set the constraints to fill the width and height then add an image to your asset catalogue. 完成此操作并设置约束以填充宽度和高度后,将图像添加到资产目录中。

On the properties of the image within the catalogue set the 'width class' and 'height class' to 'Any & compact'. 在目录中图像的属性中,将“width class”和“height class”设置为“Any&compact”。 Then you'll have spaces for images for Any and compact height (landscape) and Any and compact width (portrait). 然后你将拥有任意和紧凑高度(风景)和任意和紧凑宽度(肖像)的图像空间。 The just put your artwork in to the appropriate artwork placeholders and use that image on your storyboard. 只需将您的作品放入相应的艺术品占位符中,然后在故事板上使用该图像即可。

I believe that will then choose the appropriate artwork for you depending on how the device is held when the app launches. 我相信会根据应用程序启动时设备的持有方式为您选择合适的艺术作品。

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

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