//UISearchBar默认样式:背景灰色,搜索输入框白色
//设置背景白色,搜索框灰色
//方式1
searchBar.searchBarStyle = .minimal
searchBar.backgroundColor = UIColor.white
//方式2
searchBar.backgroundImage = UIImage(named: "searchBarBg.png")
if let searchField = searchBar.value(forKey: "_searchField") as? UITextField {
//这里可以任意定制输入框
searchField.backgroundColor = UIColor.gray
}