xcode iPhone 上的 Swift 表单

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31389683/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:28:18  来源:igfitidea点击:

Swift form sheet on iPhone

iosiphonexcodeswift

提问by Mord Fustang

I am trying to show a simple form sheet on iPhone.

我正在尝试在 iPhone 上显示一个简单的表单。

something like this http://static.squarespace.com/static/53449ac2e4b0233041dcf674/t/53937548e4b0c79f2b9b6fb7/1402172750607/TableView.gif?format=500w

像这样http://static.squarespace.com/static/53449ac2e4b0233041dcf674/t/53937548e4b0c79f2b9b6fb7/1402172750607/TableView.gif?format=500w

I dont wanna use container view though, it shouldn't be that complicated it is just a popover screen that in the middle of the screen with transparent background

不过我不想使用容器视图,它不应该那么复杂,它只是一个弹出屏幕,位于屏幕中间,具有透明背景

However even though I do these steps:

但是,即使我执行了以下步骤:

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

enter image description here

在此处输入图片说明

performSegueWithIdentifier("formSheet", sender: self)

performSegueWithIdentifier("formSheet", sender: self)

form sheet view controller still shown as full screen like a modal view controller.

表单视图控制器仍然像模态视图控制器一样全屏显示。

How to fix this ?

如何解决这个问题?

回答by ndmeiri

According to the documentation,

根据文档,

The presentation style determines how a modally presented view controller is displayed on the screen. On iPhone and iPod touch devices, modal view controllers are always presented full-screen, but on iPad devices there are several different presentation options. For a list of possible presentation styles, and their compatibility with the available transition styles, see the “UIModalPresentationStyle” constant descriptions.

呈现风格决定了模态呈现的视图控制器如何在屏幕上显示。在 iPhone 和 iPod touch 设备上,模态视图控制器总是全屏显示,但在 iPad 设备上有几种不同的显示选项。有关可能的演示样式及其与可用过渡样式的兼容性的列表,请参阅“UIModalPresentationStyle”常量说明。

Thus, you will not be able to show a Form Sheet on an iPhone, unless you use some third-party library to achieve the same effect. Here is one such library: MZFormSheetController.

因此,您将无法在 iPhone 上显示表单,除非您使用某些第三方库来实现相同的效果。这是一个这样的库:MZFormSheetController

See the UIViewController Class Referencefor more information.

有关更多信息,请参阅UIViewController 类参考