gpt4 book ai didi

ios - 如何更改 UIPopoverPresentationController 后面的叠加层的不透明度?

转载 作者:可可西里 更新时间:2023-11-01 03:51:21 25 4
gpt4 key购买 nike

我正在使用 UIPopoverPresentationController 在 iOS 应用程序中呈现弹出窗口。当它出现时,我想调暗弹出窗口后面的背景。我怎样才能做到这一点?某处是否有它的 API,或者当我显示弹出窗口时我是否必须在主视图上覆盖一些东西?

最佳答案

在 swift 3 中,您可以访问叠加层:

extension UIPopoverPresentationController {

var dimmingView: UIView? {
return value(forKey: "_dimmingView") as? UIView
}
}

将 Controller 设置为弹出模式后

controller.modalPresentationStyle = UIModalPresentationStyle.popover
controller.popoverPresentationController.dimmingView.backgroundColor = UIColor.black.withAlphaComponent(0.4)

关于ios - 如何更改 UIPopoverPresentationController 后面的叠加层的不透明度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32697436/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com