swift - 如何关闭模态视图之外的 modalView

标签 swift segue presentmodalviewcontroller

我有一个 segue 类型是模态的,我将它的 presentationstyle 设置为 formsheet。

enter image description here

这是屏幕截图。

enter image description here

当我点击变暗的 View 时,“弹出窗口” View 不会自行消失。在模态视图外部点击时是否有任何技巧可以自行消失?

最佳答案

这可以通过使用 UIViewController 中的 UIPopoverController 类和 modalInPopover 属性来实现。将 modalInPopover 设置为 true 原因拥有的弹出 Controller 在显示时禁止在此 View Controller 之外进行交互。默认值为 false。 Here is the full doc.

关于swift - 如何关闭模态视图之外的 modalView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26796438/

相关文章:

swift - 将可选字符串属性的 Realm 对象更新为零?

xcode - 使用导航返回按钮放松 segue

xcode - 将数据从第二个 View 传递到第一个 View Controller

iphone - UINavigationController 与 PresentModalViewController

ios - 为什么标签的默认类型是强制展开的可选类型?

ios - 我如何在 Swift 中的 RunTIme 上创建或生成新实体

swift - 可选绑定(bind)评估可选(nil)的不需要的行为

ios - 如何在编辑模式下(在 UITableView 中)执行不同的 segue?

iphone - iOS:相机 View 可以(应该)是默认 View (可以以模式方式启动其他屏幕)吗?

iphone - 当 modalPresentationStyle 设置为 UIModalPresentationCurrentContext 时没有动画