How to change navigation bar & back button colour iOS 15
These lines are totally pointless:
let navigationBar = UINavigationBar()
navigationBar.tintColor = .white
navigationBar.standardAppearance = appearance
You are creating a navigation bar, configuring it, and throwing it away. That does nothing for your app. Rewrite meaningfully:
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.titleTextAttributes = [.foregroundColor: UIColor.white]
appearance.backgroundColor = .red
let proxy = UINavigationBar.appearance()
proxy.tintColor = .white
proxy.standardAppearance = appearance
proxy.scrollEdgeAppearance = appearance
How to dynamically change navigation bar color on ios15?
In your VC you can try adjusting the view.backgroundColor
UINavigationBar?.view.backgroundColor = MY_COLOR
Change current colour of NavigationBar in iOS15
the NavBar current-colour change based on user input while the app is running(after application(didFinisLaunching) has been called) is not working
You cannot change a navigation bar color while that navigation bar is showing by using the appearance
proxy. The appearance
proxy affects only future interface elements. You need to apply your UINavigationBarAppearance to the existing navigation bar directly:
self.navigationController?.navigationBar.standardAppearance = appearance
self.navigationController?.navigationBar.scrollEdgeAppearance = appearance
How to change back button color in nav bar?
Use Below To Change Back Button Color:
navigationController?.navigationBar.tintColor = UIColor.red
To Change Title Color of The Navigation Bar Use:
navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.red]
What is the right way to set back button arrow tint in ios 13
The new way of setting the back button color of the appearance (proxy) would be:
let appearance = UINavigationBarAppearance()
// Apply the configuration option of your choice
appearance.configureWithTransparentBackground()
// Create button appearance, with the custom color
let buttonAppearance = UIBarButtonItemAppearance(style: .plain)
buttonAppearance.normal.titleTextAttributes = [.foregroundColor: UIColor.white]
// Apply button appearance
appearance.buttonAppearance = buttonAppearance
// Apply tint to the back arrow "chevron"
UINavigationBar.appearance().tintColor = UIColor.white
// Apply proxy
UINavigationBar.appearance().standardAppearance = appearance
// Perhaps you'd want to set these as well depending on your design:
UINavigationBar.appearance().compactAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = appearance
Related Topics
Set the Size and Position of All Windows on the Screen in Swift
Sprite Kit Physicsbody.Resting Behavior
Firestore Order by Time But Sort by Id
How to Avoid Nested Navigation Bars in Swiftui
Writing Data to an Nsoutputstream in Swift 3
Prevent Nsurlsession from Caching Responses
Confusion Due to Swift Lacking Implicit Conversion of Cgfloat
Swift Closures Causing Strong Retain Cycle with Self
App Delegate Accessing Environment Object
iOS Facebook Sdk: Login Doesn't Return Email Despite Permissions Granted
Parse.Com Querying User Class (Swift)
How to Return a First Word from a String in Swift
Coreplot with Swift: There Is No Yaxis.Majorintervallength
Showing Cells in Demands in Uicollectionview with Vertical Infinite Scroll