Reputation: 179
I am trying to set the background color of a UISearchController in Swift 5.
I have tried methods mentioned in other threads but I believe they are outdated.
searchController.barTintColor = UIColor.redColor()
Error Message: Value of type 'UISearchController' has no member 'barTintColor'
Upvotes: 0
Views: 378
Reputation: 1577
searchController.searchBar.barTintColor = UIColor.red
searchController.searchBar.searchBarStyle = .default
i.e
if your searchBarStyle is .minimal, you won’t be able to change the barTintColor. It will remain white.
Upvotes: 4