iOS UINavigationController 在将背景设置为透明后显示黑屏

iOS UINavigationController after setting background to transparent shows black screen

UINavigationController 我遇到了一个非常奇怪的问题。 我试图在 UINavigationController 中呈现不透明的 UIViewController,并且我想看到模糊的先前控制器内容。 我将 alpha 设置为 UIViewController view:

view.alpha = 0.9

然后我尝试摆脱 UINavigationController 背景:

navigationController?.view.backgroundColor = .clear

最初在 UINavigationController 动画过渡期间一切看起来都很好,但在动画结束后 UINavigationController 背景变为黑色。此问题仅在颜色透明时存在。

也许其他人遇到过这个问题?

如果您以模态方式显示导航控制器,请尝试将其 modalPresentationStyle 设置为 .overFullScreen