ios - 解除模态呈现的 View Controller 时框架不正确

标签 ios objective-c uiviewcontroller presentviewcontroller uipresentationcontroller

我正在使用自定义转换和自定义 UIPresentationController 呈现一个 UIViewController。 View Controller 的 View 不会覆盖整个屏幕,因此呈现 View Controller 仍然可见。

接下来,我在这个 View Controller 的顶部展示了一个 UIImagePickerController 的实例。问题是,当我关闭图像选择器时,呈现 View Controller 的框架会覆盖整个屏幕,而不仅仅是我希望它覆盖的部分。在我的自定义 UIPresentationController 中由 frameOfPresentedViewInContainerView 指定的框架似乎被完全忽略了。

只有当图像选择器显示 UIModalPresentationOverCurrentContextmodalPresentationStyle 时,我的框架才会保持完整(这是有道理的,因为首先没有 View 从 View 层次结构中删除) .不幸的是,这不是我想要的。我希望图像选择器全屏显示,无论出于何种原因,这似乎弄乱了我的布局。我在这里可能做错或忘记的任何事情吗?有什么建议吗?

最佳答案

我尝试了提到的两种包装方法。使用这种包装方法的一个副作用是设备旋转显示不佳 - 在呈现的 View 周围引入黑框。

尝试将呈现的 UIImagePickerControllermodalPresentationStyle 设置为 UIModalPresentationOverFullScreen,而不是使用环绕技巧。这意味着图像选择器下的 View 在呈现/关闭期间不会从 View 层次结构中删除/恢复。

关于ios - 解除模态呈现的 View Controller 时框架不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37949619/

相关文章:

php - 将数据从 php 导入 tableview 的最佳方法

ios - 无法在 Alert() 上单击“确定”

objective-c - Objective-C 中 double 的范围是多少?

ios - objective-c 和 swift 中 NSDate 的大小是多少

ios - 未调用 IIViewDeckController 的中心 viewController 的 childViewController 上的 viewWillAppear

ios - 尝试检查 View Controller 是否已加载,然后将其呈现在容器中(UISegmentedController)

ios - ipad中的下拉框

objective-c - 如何捕捉 MPMoviePlayerController 旋转事件?

ios - 导航 Controller 始终为零

ios - 如何确保我的 for in 循环使我只能执行一个 segue?