searchBar视图的UISearchController属性,如何去除黑色边框线?

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

在使用UISearchController时,尝试修改searchBar的barTintColor属性,改变color.Results呈现两条黑线,效果如下图。

如何去除两条黑线?

我的代码:

// 搜索结果控制器
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

试试这个

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