我使用 IB 创建了一个 segue 来呈现另一个 View 的弹出窗口。
我在 prepareForSegue
中添加了一个代码来删除 UIPopoverPresentationControllerDelegate 到初始 Controller 。
然后我设置了演示风格:
func adaptivePresentationStyleForPresentationController(controller: UIPresentationController,
traitCollection: UITraitCollection) -> UIModalPresentationStyle {
return UIModalPresentationStyle.None
}
这给了我一个很好的标准弹出窗口。
但是,我想做一个半透明的popover。
我尝试了一些事情:
- 我在 IB 中将背景颜色设置为“清晰”
- 我尝试在弹出 View 上设置一个 alpha
最佳答案
要让一个 View Controller 在另一个之上且透明,您需要返回 UIModalPresentationStyle.OverCurrentContext
。
关于ios - 如何使 iOS 9 的 UIPopoverPresentationController 半透明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33680483/