2016-01-06 73 views
1

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

回答

4

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