在 iOS15 上,我不再能够设置为黑色
UINavigationBar.appearance().tintColor = .white
UINavigationBar.appearance().barTintColor = UIColor(hexString: "#000000")
UINavigationBar.appearance().barStyle = UIBarStyle.black
我已经通过更改解决了这个问题
let appearance = UINavigationBarAppearance()
appearance.configureWithTransparentBackground()
appearance.backgroundColor = .black
appearance.titleTextAttributes = [.foregroundColor: UIColor.white]
appearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
UINavigationBar.appearance().standardAppearance = appearance;
UINavigationBar.appearance().scrollEdgeAppearance = UINavigationBar.appearance().standardAppearance;
但现在我遇到了缺少电池/时钟图标的问题