I have a default navigation bar on iOS 15, initially the bar itself has a tranparent background.
But when I scroll the view in the view controller, to make some content of it underneath the navigation bar. Then the bar suddenly has a visible background.
I haven't done any special setting to my navigation bar. And tried setting scrollEdgeAppearance with no luck.
if #available(iOS 13.0, *) {
let barAppearance = UINavigationBarAppearance()
barAppearance.configureWithTransparentBackground()
navigationController?.navigationBar.scrollEdgeAppearance = barAppearance
}
Add couple of lines to your code:
if #available(iOS 13, *) {
let barAppearance = UINavigationBarAppearance()
barAppearance.configureWithTransparentBackground()
barAppearance.backgroundColor = .clear
barAppearance.shadowColor = nil
navigationController?.navigationBar.isTranslucent = true
navigationController?.navigationBar.scrollEdgeAppearance = barAppearance
navigationController?.navigationBar.standardAppearance = barAppearance
}