我正在尝试在buttonClick上显示searchController。但是,单击按钮时似乎会产生错误。我在presentViewController
行收到错误。为了达到这个目的,我做错了什么?
顺便说一下,我在tableViewController
func searchButtonClicked(sender: UIBarButtonItem) {
searchController = UISearchController(searchResultsController: self)
// searchController.searchResultsUpdater = self
searchController.hidesNavigationBarDuringPresentation = false
searchController.dimsBackgroundDuringPresentation = false
self.definesPresentationContext = true
self.presentViewController(self.searchController, animated: true, completion: nil)
}