与Segue的UISearchbar(UISearchResultsUpdating)不排除
我有一个UISearchBar
的问题。 当我search一些与UITableView
相结合的文本,并单击一个结果单元格时, UISearchBar
在下一个UIViewController
仍然可见。 UISearchbar
仍然存在(与关键字)
所以,当你点击一个结果,生病(在下一个视图控制器),但search栏和键盘仍然显示。
我如何解雇目前的UISearchController
,使search栏和键盘不显示在下一个UIViewController
?
我努力了:
definesPresentationContext = true
我试图解雇presentingViewController
。
我在做准备for segue所有这一切。
我的想法是,我必须解雇UISearchController
…但我怎么能在UISearchController
访问它(在searchResultsViewControllers
– 这是一个tableViewController
是用来呈现searchResults
)
试试下面的代码来closuressearch栏:
[yourSearchController.searchBar resignFirstResponder];
你必须使用这样的东西,忘了definePresentationContext
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { searchController.active = false //This will dismiss the searchcontroller, use your own variable for searchController. //CALL THE SEGUE YOU WANT BELOW }