1

Basically, after searching in the UISearchBar, I get a white space beneath the UITableView.

My problem gets fixed in iOS 7 with this answer: https://stackoverflow.com/a/19162257/2394787

But in iOS 8 the contentInset gets messed up and I can't scroll down to see the rest of the results.

func searchDisplayController(controller: UISearchDisplayController, didHideSearchResultsTableView tableView: UITableView) {
    NSNotificationCenter.defaultCenter().removeObserver(self, name: UIKeyboardWillHideNotification, object: nil)
}

func searchDisplayController(controller: UISearchDisplayController, willShowSearchResultsTableView tableView: UITableView) {
    NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("keyboardWillHide"), name: UIKeyboardWillHideNotification, object: nil)
}

func keyboardWillHide() {
    searchDisplayController?.searchResultsTableView.contentInset = UIEdgeInsetsZero
    searchDisplayController?.searchResultsTableView.scrollIndicatorInsets = UIEdgeInsetsZero
}
Community
  • 1
  • 1
diogo.appDev
  • 1,595
  • 5
  • 16
  • 30

0 Answers0