如何使UIPopoverPresentationController对iOS 9半透明

Vic*_*nin 4 popover ios swift ios9

我使用IB来创建一个segue来呈现另一个视图popover.

我添加了一个代码来prepareForSegue将UIPopoverPresentationControllerDelegate释放到初始控制器.

我设置了演示风格:

func adaptivePresentationStyleForPresentationController(controller: UIPresentationController,
     traitCollection: UITraitCollection) -> UIModalPresentationStyle {
      return UIModalPresentationStyle.None
}
Run Code Online (Sandbox Code Playgroud)

这给了我一个很好的标准弹出窗口.

但是,我想制作一个半透明的popover.

我尝试了几件事:

  • 我在IB中将背景颜色设置为"清除"
  • 我试图在popover视图上设置alpha

bsa*_*zin 6

要使视图控制器具有透明度,您需要返回UIModalPresentationStyle.OverCurrentContext.