0

I have a problem when I try to change interface style (dark or light). If I set dark mode I get the navigation bar remains light when I scroll. If I set light mode the navigation bar becomes black. How can I solve this? I use this code to change userInterfaceStyle:

window?.overrideUserInterfaceStyle = .dark

enter image description here

TheCesco1988
  • 280
  • 1
  • 2
  • 10

1 Answers1

0

I found a solution by myself. For everyone that has this problem the solution is:

let appearance = UINavigationBarAppearance()
    appearance.configureWithOpaqueBackground()
    appearance.backgroundColor = .systemBackground
    UINavigationBar.appearance().standardAppearance = appearance
    UINavigationBar.appearance().scrollEdgeAppearance = UINavigationBar.appearance().standardAppearance

put this code inside TabBarController

TheCesco1988
  • 280
  • 1
  • 2
  • 10