gpt4 book ai didi

objective-c - UIModalPresentationStyle.FormSheet 在 iPad 上始终全屏显示 (SWIFT)

转载 作者:IT王子 更新时间:2023-10-29 05:53:48 25 4
gpt4 key购买 nike

我正在尝试将一些 Objective-C 代码转换为 SWIFT。

我正在将 UIViewController 作为表单加载。这是 objective-c 中的代码:

generalPopup.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
generalPopup.modalPresentationStyle = UIModalPresentationFormSheet;

这是 Swift 中的代码:

generalPopup.modalTransitionStyle = UIModalTransitionStyle.CoverVertical
generalPopup.modalPresentationStyle = UIModalPresentationStyle.FormSheet

在 Objective-C 中, View 显示为 FormSheet。在 swift 中,CoverVertical 得以保留,但 View 占据了整个屏幕,而不是显示为 FormSheet。

提醒一下,根据 Apple 的说法,FormSheet 是:

A view presentation style in which the width and height of the presented view are smaller than those of the screen and the view is centered onscreen. If the device is in a landscape orientation and the keyboard is visible, the position of the view is adjusted upward so the view remains visible. All uncovered areas are dimmed to prevent the user from interacting with them.

最佳答案

继续引用文档中的内容:

In a horizontally compact environment, this option behaves the same as UIModalPresentationFullScreen.

看起来你有一个“水平紧凑的环境”。检查 swift 项目中的 Storyboard设置。

关于objective-c - UIModalPresentationStyle.FormSheet 在 iPad 上始终全屏显示 (SWIFT),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25589967/

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