iOS - Swift - 如何在不禁用背景的情况下显示 UIAlertViewController

iOS - Swift - How to display UIAlertViewController without disabling background

我想在屏幕顶部显示弹出视图,但同时也启用实际屏幕。用户应该能够在屏幕控制器上执行所有触摸操作,同时在弹出视图上显示和允许触摸操作。背景当然没有褪色。

我没有看到满足此需求的现有 UIAlertController 样式。 UIAlertController 有可能吗? (PS。使用 UIPopoverPresentationController 自定义样式,设法禁用淡入淡出但仍然无法让触摸控件在背景屏幕上工作)

听起来您可能想研究 UIPopoverPresentationController 上的 passthroughViews 属性。来自文档:

"When displayed, taps outside of the popover window cause the popover to be dismissed automatically. To allow the user to interact with the specified views and not dismiss the popover, you can assign one or more views to the passthroughViews property." https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIPopoverController_class/