搜索栏不会消失后,继续到新的ViewController

问题描述:

Search Bar不希望在延续到新的ViewController后消失。我创建search bar这样做:搜索栏不会消失后,继续到新的ViewController

self.searchBar = UISearchController(searchResultsController: nil) 
    self.searchBar.searchResultsUpdater = self 
    self.searchBar.dimsBackgroundDuringPresentation = false 


    self.navigationController?.extendedLayoutIncludesOpaqueBars = true 
    self.tableView.tableHeaderView = self.searchBar.searchBar 
    self.tableView.reloadData() 

TableViewController SEGUE新View Controller我用这个函数:

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 

    self.performSegueWithIdentifier("ContentViewCOntroller", sender: self)  
} 

更多细节在这个图片:

First TableController where I search data

Second ViewControler with SearchBar, which schould disaper, but it still exist

您需要在执行segue之前设置searchBar.active = false。 (或在prepareForSegue