Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在导航栏中打开UISearchController时,整个应用程序将冻结_Ios_Swift_Uisearchcontroller - Fatal编程技术网

Ios 在导航栏中打开UISearchController时,整个应用程序将冻结

Ios 在导航栏中打开UISearchController时,整个应用程序将冻结,ios,swift,uisearchcontroller,Ios,Swift,Uisearchcontroller,我正在制作一个包含加密货币列表的应用程序。应该能够在这3个过滤列表(BTC、ETH、USD)中进行搜索。我唯一的问题是搜索栏 只要我按下“放大镜”图标,搜索栏就会出现,但整个应用程序都冻结了。我无法按“取消”,键入栏,关闭它并移动UITableView。我不明白这种行为的原因 var searchController : UISearchController! @IBAction func searchingButton(_ sender: Any) { searchControl

我正在制作一个包含加密货币列表的应用程序。应该能够在这3个过滤列表(BTC、ETH、USD)中进行搜索。我唯一的问题是搜索栏

只要我按下“放大镜”图标,搜索栏就会出现,但整个应用程序都冻结了。我无法按“取消”,键入栏,关闭它并移动UITableView。我不明白这种行为的原因

var searchController : UISearchController!

@IBAction func searchingButton(_ sender: Any) {
    searchController = UISearchController(searchResultsController: nil)
    searchController.delegate = self
    searchController.searchBar.delegate = self
    searchController.searchBar.placeholder = "All currency pairs"
    searchController.hidesNavigationBarDuringPresentation = false
    searchController.searchResultsUpdater = self
    definesPresentationContext = true
    navigationItem.searchController = self.searchController
    navigationItem.hidesSearchBarWhenScrolling = false

    searchButton.isHidden = true

    present(searchController, animated: true, completion: nil)
}


extension ViewController:  UISearchControllerDelegate {
    func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
        navigationItem.searchController = nil
        navigationController?.view.setNeedsLayout()
        navigationController?.view.layoutIfNeeded()
        self.indexChange(self.segmentedControl!)
    }
}

请帮我解决这个问题。如果需要,将提供更多的代码。

嗯,这很奇怪,但是清理项目和系统重启有帮助