UISearchController的SearchBar处于活动状态时位于状态栏下(ios 9.3,ios 8.4)

时间:2016-12-22 12:38:50

标签: swift3 ios10 uisearchcontroller

enter image description here

let storyboard = UIStoryboard(name: "ProductSearch_iPhone", bundle: nil)
   let controller : RSearchResultController = storyboard.instantiateViewController(withIdentifier: "SResult") 
                                              as! RSearchResultController

    searchController                        = UISearchController(searchResultsController:controller)
    searchController.searchResultsUpdater   = controller
    searchController.dimsBackgroundDuringPresentation   = true
    controller.delegate                                 = self
    searchController.searchBar.delegate                 = controller
    self.present(searchController, animated: true, completion: nil)
    definesPresentationContext = true

我已经添加了UISearchController,没有像许多其他教程那样与UITableview集成。

1 个答案:

答案 0 :(得分:0)

最后我找到了解决方案。问题不是设备特定的,ios 9和ios8显示失败的设计,而在ios10中它很好。

definesPresentationContext = true 

以上代码行是问题,写在意图上搜索栏当我导航到某个地方&当 UISearchController 处于活动状态时回来。但根据我的要求,当 UISearchController 处于活动状态时,我无法选择导航。