ios - 如何使 iOS 9 的 UIPopoverPresentationController 半透明

标签 ios swift ios9 popover

我使用 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/

相关文章:

ios - SKProductsResponse 仅返回无效的产品 ID

swift - iAd 显示后调整 View 大小

ios - 如何将 NSAppTransportSecurity 添加到我的 info.plist 文件中?

swift - 在 SWIFT 的表格 View 中填充自定义单元格时出错

ios - 类型错误 : Cannot read property 'name' of undefined ionic

ios - 自定义推送和弹出动画 iOS 7 和 8

ios - 如何正确使用 Codable、CoreData 和 NSSet 关系?

uiwebview - 使用 Xcode UI 测试测试 UIWebView

ios - 清除 contenteditable div 时,键盘在 Safari iOS 6 中停止工作

swift - 对复合 NSPredicate 进行优先级排序