Created
September 17, 2018 08:56
-
-
Save marinat/a42d0c75a7fef084c2ebff22bda20e03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. | |
let searchController = UISearchController(searchResultsController: nil) | |
UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).defaultTextAttributes = [NSAttributedStringKey.foregroundColor.rawValue: UIColor.white] | |
if let textfield = searchController.searchBar.value(forKey: "searchField") as? UITextField { | |
//let ss = sw?.subviews | |
if let backgroundview = textfield.subviews.first { | |
// Background color | |
backgroundview.backgroundColor = hexStringToUIColor(hex: "#8392B0") | |
} | |
} | |
navigationItem.searchController = searchController | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment