Reputation: 198
On iOS15 I was no longer able to set as black
UINavigationBar.appearance().tintColor = .white
UINavigationBar.appearance().barTintColor = UIColor(hexString: "#000000")
UINavigationBar.appearance().barStyle = UIBarStyle.black
I've fixed that with change
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;
but now I have a problem with missing battery / clock icons
Upvotes: 1
Views: 1260
Reputation: 19014
Change status bar style from the info.plist
1: Set UIViewControllerBasedStatusBarAppearance
to false
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
2: Add Status bar style key and set style like Light Content
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleLightContent</string>
Upvotes: 1
Reputation: 1319
In your UINavigationController
override preferredStatusBarStyle
and return .lightContent
class MyNavigationController: UINavigationController {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
}
Upvotes: 1