I’ve been seek for over two days now and easily might’t discover a solution. Hope anybody on the market can assist?
- Briefly, the undertaking I’m engaged on holds a searchbar in its navigationbar.
- This searchbar is a component a part of a UISearchController that will get handed to the
searchController
property of the view controller’snavigationItem
(see code instance). - No matter I do, the search bar at all times seems with a grey tint.
- I set all doable background and tint colors to
.clear
ornil
with no luck. - A part of the problem is that the searchbar has to remain within the navigation bar and can’t get positioned anyplace else. All different house in the true navigation bar of the true undertaking is already taken.
- I’m suing Swift5 with minimal deployment iOS 14.
This pattern code illustrates what we’re utilizing in our undertaking:
class SearchControllerTests3: UIViewController {
override func viewDidLoad() {
tremendous.viewDidLoad()
view.backgroundColor = .white
navigationItem.title = "Search Bar"
navigationController?.navigationBar.barTintColor = .white
navigationController?.navigationBar.backgroundColor = .white
navigationController?.navigationBar.tintColor = .white
navigationController?.navigationBar.layer.borderWidth = 0.2
let searchController = UISearchController()
searchController.searchBar.backgroundColor = .white
searchController.searchBar.tintColor = .white
searchController.searchBar.searchTextField.backgroundColor = .white
searchController.searchBar.searchTextField.tintColor = .white
navigationItem.searchController = searchController
}
}
The pattern code above creates the next output when offered underneath a UINavigationController