获取: let searchField =searchBar.value(forKey:"searchField")as! UITextField进行属性更改: searchField.backgroundColor = UIColor.gray