首页 > 解决方案 > 呈现 UIViewController 时 SafeAreas 行为不端

问题描述

我需要从另一个仅支持“.portrait”方向的 UIViewController (ViewControllerOne) 中展示一个仅支持“.landscape”方向的 UIViewController (ViewControllerTwo)。如果您检查下面的 .gif,您会注意到当转换发生时它会缩小“ViewControllerOne”的内容,而当您关闭“ViewControllerTwo”时也会发生同样的情况。

出现这种情况的原因与安全区域的变化有关,纵向与横向不同,反之亦然。但是,如果我们覆盖“ViewControllerOne”的supportedInterfaceOrientations 以仅支持“.portrait”,如果这些更改与不受支持的方向相关,则不应通知安全区域更改,对吧?

这是来自 iOS 的错误/限制吗?

(NO) -> What is the right way to handle this scenario?

(YES) -> What workaround do you recommend to solve this issue in the meantime?

您可以在此处查看示例项目:https ://github.com/mantuness/ExampleProject

检查下面的GIF:

在此处输入图像描述

标签: iosswift

解决方案


推荐阅读