Can't scroll in tableView while searching in UISearchController

Viewed 304

if i am searching something in the searchbar (it is embedded in the navigationBar) I can't scroll in the tableview. If i tap on the tableview while searching the search ends and i can tap the cells, but i want to be able to scroll while searching and tap cells normally.

This is how i add the searchController:

override func viewDidLoad() {
    super.viewDidLoad()
    navigationController?.navigationBar.prefersLargeTitles = true

    tableView.delegate = self
    tableView.dataSource = self

    let searchController = UISearchController(searchResultsController: nil)
    searchController.searchBar.delegate = self
    navigationItem.searchController = searchController
}
1 Answers

You need to add this:

searchController.obscuresBackgroundDuringPresentation = false;
Related