I would like to dismiss the keyboard on swipe/drag after i search for results in my searchController
.
I tried doing it through the main.storyboard
but it didn't help.
if i search and get many results i would like scroll down and then the keyboard will dismiss
and let me see my results better.If anyone can help that would be great, Thanks ahead !
Right now, When i have my results as seen in the picture the keyboard stays when i scroll down and its kind of annoying.
I am using Swift 2.3 and Xcode 8.1
Here is my searchController setup just in case :
// MARK : Search ! //
var searchController : UISearchController!
var resultsController = UITableViewController()
override func viewDidLoad() {
super.viewDidLoad()
definesPresentationContext = true
self.resultsController.tableView.dataSource = self
self.resultsController.tableView.delegate = self
self.searchController = UISearchController(searchResultsController: self.resultsController)
self.tableView.tableHeaderView = self.searchController.searchBar
self.searchController.searchResultsUpdater = self
self.searchController.dimsBackgroundDuringPresentation = true
self.searchController.searchBar.sizeToFit()
self.searchController.searchBar.barTintColor = UIColor.blackColor()
self.searchController.searchBar.endEditing(true)
self.searchController.searchBar.placeholder = "חפש ברים"
self.searchController.hidesNavigationBarDuringPresentation = false
////// MARK: END Of Search //////
}
Edit:pkc456 Has Solved it.Works,but has a tiny issue
The last result's Cell is being cut in half! :