Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change background color of uisearchcontroller

Tags:

ios

swift

How does one change the background colour of the uisearchcontroller? Atm it looks like thisenter image description here

I want it all one colour. I've attempted sc.view.tintColor = UIColor.rgb(10, green: 150, blue: 255) and sc.view.backgroundColor = UIColor.rgb(10, green: 150, blue: 255) but doesn't remove the grey bit the side

like image 843
luke Avatar asked Jul 29 '16 18:07

luke


2 Answers

Eh, with some thought I solved it.

sc.searchBar.barTintColor = UIColor.rgb(10, green: 150, blue: 255)

like image 192
luke Avatar answered Oct 14 '22 00:10

luke


     sc.searchBar.searchBarStyle = UISearchBarStyleProminent
     sc.searchBar.backgroundImage = [UIImage new]
     sc.searchBar.barTintColor = UIColor.rgb(10, green: 150, blue: 255)

set searchBarStyle to Prominent. It working for me

like image 45
Artem Konovalov Avatar answered Oct 13 '22 23:10

Artem Konovalov