When I update the placeholder text in the UISearchController's search bar to something wider than the search bar, this happens to the search icon:
I added the UISearchController and search bar by calling the following method in viewDidLoad
:
private func initSearchController() {
searchResultsController = UITableViewController()
searchResultsController.tableView.backgroundColor = UIColor(red: 51/255, green: 51/255, blue: 51/255, alpha: 1.0)
searchController = UISearchController(searchResultsController: searchResultsController)
searchResultsController.tableView.rowHeight = 50
let textFieldInsideSearchBar = searchController.searchBar.valueForKey("searchField") as? UITextField
textFieldInsideSearchBar?.textColor = UIColor.whiteColor()
searchController.searchBar.sizeToFit()
searchController.searchBar.placeholder = "SOL Southwest Kitchen & Tequila Bar"
searchController.hidesNavigationBarDuringPresentation = false
searchController.dimsBackgroundDuringPresentation = true
searchController.searchBar.searchBarStyle = .Minimal
navigationItem.titleView = searchController.searchBar
definesPresentationContext = true
searchController.searchResultsUpdater = self
searchResultsController.tableView.dataSource = self
searchResultsController.tableView.delegate = self
searchController.searchBar.delegate = self
}
What gives? Also, anyway to remove that weird gap between the back button and the search bar? If it helps, this view is the second view controller in a Navigation Controller. Using iOS9 and Swift 2.1. Thanks!