简体   繁体   中英

Can't scroll in tableView while searching in UISearchController

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
}

你需要添加这个:

searchController.obscuresBackgroundDuringPresentation = false;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM