I have this extension which allow me to have some UIView properties (for example backgroundColor):
extension UIApplication {
var statusBarView: UIView? {
return value(forKey: "statusBar") as? UIView
}
}
Then I write this code in application(didFinishLaunchingWithOptions:)
UIApplication.shared.statusBarView?.backgroundColor = #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)
UINavigationBar.appearance().barTintColor = #colorLiteral(red: 0.3411764801, green: 0.6235294342, blue: 0.1686274558, alpha: 1)
As you can see colours are the same, but result is strange because in fact they are different:
See the difference between two green colours? Why this difference happens?
Thank you!
Try to set the following value:
UINavigationBar.appearance().shadowImage = UIImage()
If this does not help, try playing around with the following commands (I use them in my apps to set everything to white background):
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .any, barMetrics: .default)
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().isTranslucent = false
UITabBar.appearance().shadowImage = UIImage()
UITabBar.appearance().backgroundImage = UIImage()
UITabBar.appearance().backgroundColor = UIColor.white