So I have an app that is basically a movie search app displayed using a UITableViewController and a UISearchController.
I have a cell that when tapped, loads more results. But when I tap it, I also want the keyboard to go away. So in the tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) method, I assume I have to call resignFirstResponder(). The problem is that it doesn't work. I've tried everything but nothing makes the keyboard disappear. I think it's because the keyboard is part of the UISearchBar, and I should call searchBar.resignFirstResponder(). The problem is that I can't access the searchBar from my UITableViewController class.
Here is what I have, none of this works:
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
//Remove Keyboard
self.resignFirstResponder()
self.view.resignFirstResponder()
self.view.endEditing(true)
self.tableView.endEditing(true)
self.navigationController?.view.endEditing(true)
self.navigationController?.resignFirstResponder()
//Do a bunch of other stuff..
}