Reputation: 4409
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.
Upvotes: 1
Views: 3238
Reputation: 7677
If you want a transparent navBar.. change this line:
appearance.configureWithOpaqueBackground()
to:
appearance.configureWithTransparentBackground()
Upvotes: 5