I put my UISearchController's search bar on navigation bar's titleView. But when I tap to search, UISearchBar does not respond. What can be the cause ?
let tvController:UITableViewController = UITableViewController()
tvController.tableView.delegate = self
tvController.tableView.dataSource = self
self.searchController = UISearchController(searchResultsController: tvController)
self.searchController?.searchResultsUpdater = self
self.searchController!.searchBar.placeholder = "Search for places"
self.searchController!.hidesNavigationBarDuringPresentation = false
self.searchController!.dimsBackgroundDuringPresentation = false;
self.searchController!.searchBar.searchBarStyle = UISearchBarStyle.Prominent
self.searchController!.delegate = self
self.searchController!.searchBar.delegate = self
self.definesPresentationContext = true
self.searchController!.searchBar.sizeToFit()
self.navigationItem.titleView = self.searchController!.searchBar
UISearchBarDelegate
to your UIViewController Definition? – blacksheep_2011