【发布时间】:2021-10-16 18:36:56
【问题描述】:
在 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;
但现在我遇到了缺少电池/时钟图标的问题
【问题讨论】:
-
这个可能会有所帮助:stackoverflow.com/a/68600926/14733292
-
嗨 Raja,设置 UIViewControllerBasedStatusBarAppearance 为 false 的选项并为我工作的所有视图控制器设置 UIStatusBarStyle。如果您将其写为答案,我会将其标记为修复。谢谢
标签: swift uinavigationbar uistatusbar ios15