i searched a lot on internet but did not find any solution for the problem, i don't want the navigation bar to be blur as in the screenshot
the colour of navigation bar does not match with the other colour even i have used the sam hex value for both. i want to fix it. please help
this is the code i am using to colour navigation bar
let navigationBarAppearace = UINavigationBar.appearance()
navigationBarAppearace.tintColor = UIColor.white
navigationBarAppearace.barTintColor = UIColor(red: 204/255.0, green: 51/255.0, blue: 51/255.0, alpha: 1.0)
What you see isn't actually blur effect, but translucent style of UINavigationBar. If you don't want translucent bar, set its isTranslucent property to false
UINavigationBar.appearance().isTranslucent = false
Use:
navigationController.navigationBar.isTranslucent = false
You can disable this blur effect by using both standard and scroll edge
By Setting
**Standard Appearance
background-color**
This setting will Work to hide the blur effect on a scroll and also to set title style on scroll
**Scroll Edge Appearance
background-color**
Appearance without scroll-like background color, title, etc.
Other Settings are remained the same like
Translucent: true etc
Related
I have a problem when I try to change interface style (dark or light). If I set dark mode I get the navigation bar remains light when I scroll. If I set light mode the navigation bar becomes black. How can I solve this?
I use this code to change userInterfaceStyle:
window?.overrideUserInterfaceStyle = .dark
I found a solution by myself.
For everyone that has this problem the solution is:
let appearance = UINavigationBarAppearance()
appearance.configureWithOpaqueBackground()
appearance.backgroundColor = .systemBackground
UINavigationBar.appearance().standardAppearance = appearance
UINavigationBar.appearance().scrollEdgeAppearance = UINavigationBar.appearance().standardAppearance
put this code inside TabBarController
I tried virtually every solution I could find for changing the background color of a UISearchController SearchBar, but none of them produced the correct color as the background. Every solution produces a somewhat darker color, and as demonstrated in the image below, white seems more pale / off-white.
How can I make the search bar a true white color?
One of the more recent "solutions" that results in white being pale is below:
let searchController = UISearchController()
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.searchController = searchController
let textFieldInsideSearchBar = searchController.searchBar.value(forKey: "searchField") as? UITextField
textFieldInsideSearchBar?.backgroundColor = UIColor.white
}
The default border style is being impacted by the navigationItem. If you remove the border style and manually set the corner radius, it should display as white. White seems to be the only color I ran into being affected by this.
Change:
textFieldInsideSearchBar?.backgroundColor = UIColor.white
To:
textFieldInsideSearchBar?.borderStyle = .none
textFieldInsideSearchBar?.cornerRadius = 10
textFieldInsideSearchBar?.backgroundColor = .white
When I put the search bar in a table header, your code above (without altering the border/radius) worked without issue, but when I tried to embed it into a navigation bar item, I ran into your problem.
I want to change the status and navigation bar from colored to transparent and from transparent to colored.
How can I do this?
enter image description here
navigationController?.navigationBar.barTintColor = .green // Set Background Color
navigationController?.navigationBar.barTintColor = .none // remove Background Color
I set my window's appearance to NSAppearanceNameVibrantDark in order to have some kind of "dark" theme, which works wonderfully. Not being a fan of pure black though, I want to lighten the UI elements a little bit.
I set the window's background color to pure white, that made the toolbar look grey, which is perfect:
But in my window, I have a NSTableView that was not affected by this change:
As you see, everything is really dark and the alternating colors for the rows are barely visible. I want to lighten up this so I tried setting the NSTableView background color to white, it didn't help. I tried setting the enclosing NSView CALayer's background color to white and this didn't help either (I specified that this view needed to have a layer with the wantsLayer property).
My most fortunate attempt was to implement tableView(_: didAddRowView: forRow:) and manually set the colors of the row views:
if row % 2 == 1 {
rowView.backgroundColor = NSColor(white: 0.4, alpha: 1)
} else {
rowView.backgroundColor = NSColor(white: 0.2, alpha: 1)
}
BUT, this doesn't affect empty rows below my data, they remain very dark. I would like the empty rows to be the same color as the populated ones.
Thanks !
NOTE: I don't care about the header row background color, it can stay the current shade of grey.
The map view shows the user's location with a default blue bubble animation. How can I change that default blue color to another color?
You can change the tintColor of the mapView with:
mapView.tintColor = UIColor.greenColor()
Put this in the viewDidLoad() of the ViewController where your mapView is embedded.
In swift 3 try with color literal
mapView.tintColor = #colorLiteral(red: 0.9607843137, green: 0.5764705882, blue: 0.003921568627, alpha: 1)
You can change the color of User Location Bubble by
step 1
step 2
step 3
Change the Tint Color