简体   繁体   English

如何呈现类似于MFMailComposeViewController的UIViewController

[英]How to Present a UIViewController similar to MFMailComposeViewController

I try to present a UIViewController similar to the way a MFMailComposeViewController is presented. 我尝试呈现一个类似于MFMailComposeViewController呈现方式的UIViewController。 but I did not find which modalPresentationStyle to use. 但我没有找到要使用的modalPresentationStyle。

MFMailComposeViewController

You can display a modal dialog like that using the pageSheet style. 您可以使用pageSheet样式显示类似的模式对话框。 Select the Segue in the storyboard and select "Page Sheet". 在故事板中选择Segue,然后选择“Page Sheet”。 This example shows Form Sheet (which is slightly smaller) - but you can select Page Sheet in that same drop down to get the larger modal dialog. 此示例显示表单(稍微小一点) - 但您可以在同一下拉菜单中选择页面表以获取更大的模式对话框。

If you are building the controller yourself, here's an example: 如果你自己构建控制器,这是一个例子:

let controller = UIStoryboard(name: Constants.Storyboard.main, bundle: nil).instantiateViewController(withIdentifier: "MyControllerIDFromStoryboard")

        controller.modalPresentationStyle = .pageSheet 

If you're using performSegue(withIdentifier:sender:) you can put the attribute on the segue itself in the storyboard. 如果您正在使用performSegue(withIdentifier:sender:) ,则可以将该属性放在故事板中的segue上。

表单

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM