I have problem with changing navigation bar color in iOS 15. In AppDelegate I'm setting UINavigationBarAppearence like this:
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.shadowImage = UIImage()
appearance.shadowColor = .clear
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = appearance
In my application, I need to change navigation bar color in multiple places in multiple colors.
Previously, just setting self.navigationController?.navigationBar.barTintColor = .yellow
did the trick but not anymore. Every time when I need to change navigation bar color, do I need to change whole UINavigationBarAppearence
class attributes? If yes, it seems like a bit overload. But I cannot find better solution.
Others methods like
self.navigationItem.setHidesBackButton(true, animated: true)
dont work anymore too. Instead
self.navigationController?.navigationBar.topItem?.setHidesBackButton(true, animated: true)
only works. All these change just seems very confusing.