Reputation: 129
In use UISearchController, try to modify the searchBar barTintColor attributes, change color.Results presented two black line, the effect such as the following picture.
how can I remove the two black line?
my code:
// 搜索结果控制器
searchVC = SearchViewController()
searchController = UISearchController(searchResultsController: searchVC)
// 设置UISearchController属性
searchController.searchResultsUpdater = self
searchController.dimsBackgroundDuringPresentation = true
// 设置UISearchBar属性
searchController.searchBar.delegate = self
searchController.searchBar.sizeToFit() //直接关系到searchBar会不会上推
searchController.searchBar.barTintColor = BackgroudGray
searchController.searchBar.tintColor = UIColor.yellowColor()
// 设置本ViewController
definesPresentationContext = true
tableView.tableHeaderView = searchController.searchBar
Upvotes: 1
Views: 445
Reputation: 374
try this one
searchController.searchBar.backgroundImage = UIImage() searchController.searchBar.backgroundColor = UIColor.lightGray
Upvotes: 3