ChildrenGreens
ChildrenGreens

Reputation: 129

UISearchController attributes of the searchBar view, how to remove the black border lines?

In use UISearchController, try to modify the searchBar barTintColor attributes, change color.Results presented two black line, the effect such as the following picture.

enter image description here

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

Answers (1)

RED
RED

Reputation: 374

try this one

searchController.searchBar.backgroundImage = UIImage() searchController.searchBar.backgroundColor = UIColor.lightGray

Upvotes: 3

Related Questions