在buttonClick上显示searchController

时间:2015-09-04 23:19:19

标签: ios swift uitableview uisearchcontroller

我正在尝试在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)
}

0 个答案:

没有答案