I would like to change grey border color in my Search Bar
to white color. Now it looks like that:
I achieved this effect after using this lines of code, but "inside border" is still grey:
var searchBar: UISearchController!
self.searchBar.searchBar.backgroundColor = UIColor.whiteColor()
self.searchBar.searchBar.layer.borderWidth = 3
self.searchBar.searchBar.layer.borderColor = UIColor.whiteColor().CGColor
self.searchBar.searchBar.layer.backgroundColor = UIColor.whiteColor().CGColor
self.searchBar.searchBar.tintColor = UIColor(red: 0.3, green: 0.63, blue: 0.22, alpha: 1)
Can somebody help me in it?
I suggest using 2 handy extensions for that:
Then just use:
Code above will give you all white searchbar but likely there will be black lines at top and bottom of the searchbar as you can see from the attachment. If you see the black lines and if you don't want them, change;
with
And you will have a clean white searchbar. Hope this solves your problem. Good luck!