import UIKit
let Color_Search_Bar = UIColor.init(white: 240.0/255.0, alpha: 1.0) // f0f0f0
class UIVViewController2: UIViewController, UISearchBarDelegate {
@IBOutlet weak var tableView: UITableView!
@IBOutlet weak var searchBar: UISearchBar!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.searchBar.sizeToFit()
self.searchBar.placeholder = "搜索"
self.searchBar.tintColor = UIColor.black
self.searchBar.delegate = self
self.searchBar.barTintColor = Color_Search_Bar
/* 去除黑线 */
self.searchBar.backgroundImage = UIImage()
self.searchBar.backgroundColor = Color_Search_Bar
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
print("click search button")
}
}