搜索栏不会消失后,继续到新的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