ios - 通用应用程序 : LaunchScreen not respecting interface builder constraint when launching in landscape

标签 ios objective-c swift xcode uistoryboard

我在使用 LaunchScreen.storyboard 时遇到了一些问题。

我的应用是通用应用,默认方向纵向,但也允许横向。

我的 LaunchScreen 非常简单。

具有 2 个约束的 UILabel :

  • 对齐通往安全区域(常数 = 30)
  • 到安全区的顶部空间(常量 = 30)

enter image description here

当我在具有模拟特征(iPhone XR、iPad、风景、肖像……)的 XCode 中检查我的 LaunchScreen 时,一切看起来都很好。

当我以纵向启动应用程序时,一切看起来正常

然后我将模拟器(或真实设备)切换为横向并重新运行该应用。

这次 UILabel 不遵守它的约束。标签触及黑色凹口,顶部空间似乎是定义大小的两倍。

enter image description here

你有同样的问题吗?我该如何解决?

最佳答案

Apple 在他们的 documentation 中描述了这一点如下:

At launch time, apps should always set up their interface in a portrait orientation. After the application(_:didFinishLaunchingWithOptions:) method returns, the app uses the view controller rotation mechanism described above to rotate the views to the appropriate orientation prior to showing the window.

所以我相信您所追求的行为恐怕并没有得到 Apple 的特别支持。作为旁注,我不完全确定他们如何在 iPad 上支持它。

关于ios - 通用应用程序 : LaunchScreen not respecting interface builder constraint when launching in landscape,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55825509/

相关文章:

objective-c - NSURLConnection 在禁用互联网连接的情况下没有给出错误?

iphone - 指针与 nil 初始化指针

ios - 从 Parse 中检索图像

objective-c - 如何在没有 IB 的情况下添加调整大小

iOS swift 如何知道即使应用程序被终止,是否有任何联系人已更新

ios - MKMapView 设置区域 : causes app to crash in iOS SDK

ios - parse.com 'retweet' 模式太冗长

ios - 将对象添加到 NSMutableArray - 奇怪的行为

ios - 你如何测试 iOS 框架

ios - 是否有任何公共(public) API 可以检测 iOS 16(beta 3)中的锁定模式?