kiran
kiran

Reputation: 4409

iOS 15 Navigation Bar Transparent issue

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

Upvotes: 1

Views: 3238

Answers (1)

TonyMkenu
TonyMkenu

Reputation: 7677

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

appearance.configureWithOpaqueBackground()

to:

appearance.configureWithTransparentBackground()

Upvotes: 5

Related Questions