luke
luke

Reputation: 2773

Change background color of uisearchcontroller

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

Upvotes: 8

Views: 12040

Answers (3)

Raydemo
Raydemo

Reputation: 39

This works for me simplely

    searchController.searchBar.backgroundColor = UIColor.clear

according to https://forums.developer.apple.com/thread/121871

Upvotes: 0

Artem Konovalov
Artem Konovalov

Reputation: 123

     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

Upvotes: 12

luke
luke

Reputation: 2773

Eh, with some thought I solved it.

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

Upvotes: 15

Related Questions