小编Mic*_*ael的帖子

即使设置为清除,弹出窗口也具有黑色背景

我有一个UIViewController我正在展示另一个。它应该显示为具有透明背景的弹出窗口。它显示正常,但背景是黑色的。它在嵌入到UINavigationController.

问题是背景颜色是黑色,我看不到下面的视图,即使所有背景颜色都设置为清除。我什至尝试在呈现控制器时设置背景清晰,但仍然没有。我将它设置Storyboard为显示当前上下文并交叉溶解。

视图调试器也不会在层次结构中将任何视图显示为黑色。不知道出了什么问题,感谢任何帮助,谢谢!

let vc = UIStoryboard.init(name: "AccountSettings", bundle: nil).instantiateViewController(withIdentifier: "upgradeVCPopup") as! UpgradeVCPopup
let nav = UINavigationController(rootViewController: vc)
nav.view.backgroundColor = .clear
vc.view.backgroundColor = .clear
if let navigationController = self.navigationController {
    navigationController.present(nav, animated: true, completion: nil)
} else {
    self.present(nav, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)

xcode popup uinavigationcontroller presentmodalviewcontroller swift

2
推荐指数
1
解决办法
1861
查看次数