这就是我设置我的方式 UIsearchController
private func setupSearchController() {
let searchResultsController = storyboard!.instantiateViewControllerWithIdentifier(DBSearchOptionControllerIdentifier) as! DBSearchOptionController
searchController = UISearchController(searchResultsController: searchResultsController)
let frame = searchController.searchBar.frame
searchController.searchBar.frame = CGRectMake(0, 50, view.bounds.size.width, 44.0)
searchController.searchResultsUpdater = self
view.addSubview(searchController.searchBar)
searchController.searchBar.text = "mmm"
view.bringSubviewToFront(searchController.searchBar)
searchController.searchBar.bringSubviewToFront(view)
}
Run Code Online (Sandbox Code Playgroud)
这是我初始化后的看法UISearchController:

这是我开始在UISearchBar中输入时的样子:

为什么我的搜索栏会消失?
这非常有趣,因为现在当我停止应用程序时,你可以看到它确实在那里:-)那么为什么它不可见?
