iOS 15 Navigation Bar Transparent issue

2.8k Views Asked by At

Trying Transperent for NavigationBar in iOS 15,

Its working in below version not in iOS 15.

override func viewDidLoad() {
        // Clear the background image.
        self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
        // Clear the shadow image.
        self.navigationController?.navigationBar.shadowImage = UIImage()
        // Ensure the navigation bar is translucent.
        self.navigationController?.navigationBar.isTranslucent = true

        if #available(iOS 15, *) {
            let appearance = UINavigationBarAppearance()
            appearance.configureWithOpaqueBackground()
            appearance.shadowImage = UIImage()
            appearance.backgroundColor = .clear
            UINavigationBar.appearance().standardAppearance = appearance
            UINavigationBar.appearance().scrollEdgeAppearance = appearance
        }
}

How to make NavigationBar Transparent iOS 15. enter image description here

1

There are 1 best solutions below

1
TonyMkenu On

If you want a transparent navBar.. change this line:

appearance.configureWithOpaqueBackground()

to:

appearance.configureWithTransparentBackground()