UISearchBar不会在推送segue上解雇

时间:2015-05-12 06:51:18

标签: ios swift

我正在尝试iOS 8的UISearchController。当我单击单元格时,它将推送segue并显示另一个视图控制器。但是,搜索控制器/栏仍然在下一个控制器上。另外,我注意到状态栏背景是白色的,而它应该是灰色的,因为searchBar背景颜色是灰色的。有什么我想念的吗?

这是我用来初始化搜索控制器的代码

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.

    searchController = UISearchController(searchResultsController: nil)
    searchController.searchResultsUpdater = self
    searchController.hidesNavigationBarDuringPresentation = false
    searchController.dimsBackgroundDuringPresentation = false
    searchController.searchBar.sizeToFit()
    tableView.tableHeaderView = searchController.searchBar
}

截图:

enter image description here

1 个答案:

答案 0 :(得分:9)

prepareForSegue

中的手动停止searchController.active = false
   searchController.definesPresentationContext = true

或者在viewDidLoad

中添加它
PDF new action
    user uploads PDF 

PDF show action
    PDF is displayed
    JavaScript reads PDF
    JavaScript populates Ryan's raw data
    Raw data is exported with PDF data included