Search code examples
iosswiftuinavigationcontrollertransparent

iOS UINavigationController after setting background to transparent shows black screen


I got a really weird issue with UINavigationController. I am trying to present opaque UIViewController in UINavigationControllerand I want to see blurry previous controller content. I set alpha to UIViewController view:

view.alpha = 0.9

Then I try to get rid of UINavigationController background:

navigationController?.view.backgroundColor = .clear

Initially during the UINavigationController animation transition everything looks fine, but after animation finishes UINavigationController background becomes black. This issue only exists if color is transparent.

Maybe someone else experienced this issue?


Solution

  • If you are showing navigation controller modally try to set it's modalPresentationStyle to .overFullScreen