iosswiftuinavigationbarios13uinavigationbarappearance

Transparent navigation bar iOS 13


Can't create transparent NavigationBar iOS 13.

I have custom UINavigationBar, where I configure UINavigationBarAppearance in

override init(frame: CGRect) {
    super.init(frame: frame)
    self.configure()
}

required init?(coder: NSCoder) {
    super.init(coder: coder)
    self.configure()
}

Configuration code:

let appearance = UINavigationBarAppearance()
appearance.configureWithTransparentBackground()
appearance.shadowColor = .clear
appearance.backgroundColor = .clear

And set it to:

self.compactAppearance = appearance
self.standardAppearance = appearance
self.scrollEdgeAppearance = appearance

And by the result I have this:

enter image description here

Expected result: NavigationBar should be transparent


Solution

  • Works for me:

    self.compactAppearance = appearance
    self.standardAppearance = appearance
    self.scrollEdgeAppearance = appearance
    self.backgroundColor = appearance.backgroundColor