gpt4 book ai didi

ios - 在 Split View的弹出式 Controller 中以 UIModalPresentationFormSheet 样式呈现的对话框在旋转后消失

转载 作者:行者123 更新时间:2023-12-01 18:31:55 28 4
gpt4 key购买 nike

我在我的应用程序中使用 Split View,并在弹出 Controller 中以纵向模式呈现一个 UIModalPresentationFormSheet 样式的对话框,但是在我旋转到横向模式后,对话框自动消失。我不希望它消失,我希望用户可以在旋转后使用对话框,我该怎么办?

我发现如果我第一次以横向模式显示对话框,旋转到纵向模式后对话框不会消失,这很奇怪。

任何提示或帮助将不胜感激。

最佳答案

iOS 将尝试自动重新定位 View ,但这取决于弹出框的呈现位置。从文档

If the user rotates the device while a popover is visible, the popover controller hides the popover and then shows it again at the end of the rotation. The popover controller attempts to position the popover appropriately for you but you may have to present it again or hide it altogether in some cases. For example, when displayed from a bar button item, the popover controller automatically adjusts the position (and potentially the size) of the popover to account for changes to the position of the bar button item. However, if you remove the bar button item during the rotation, or if you presented the popover from a target rectangle in a view, the popover controller does not attempt to reposition the popover. In those cases, you must manually hide the popover or present it again from an appropriate new position. You can do this in the didRotateFromInterfaceOrientation: method of the view controller that you used to present the popover.

关于ios - 在 Split View的弹出式 Controller 中以 UIModalPresentationFormSheet 样式呈现的对话框在旋转后消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7962050/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com