在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;但现在我遇到了丢失电池/时钟图标的问题


发布于 2021-08-16 07:05:49
从info.plist更改状态栏样式
1:将UIViewControllerBasedStatusBarAppearance设置为false
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>2:添加状态栏样式键并将样式设置为类似于轻量内容
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>发布于 2021-08-13 18:20:41
在UINavigationController中重写preferredStatusBarStyle并返回.lightContent
class MyNavigationController: UINavigationController {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
}https://stackoverflow.com/questions/68773531
复制相似问题