UISearchController 的 SearchBar 激活时位于 statusbar 下方( ios 9.3 ,ios 8.4)
SearchBar of UISearchController is lying under statusbar when it actives( ios 9.3 ,ios 8.4)
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 集成。
最后我发现 solution.The 问题不是特定于设备的,ios 9 和 ios8 显示损坏的设计,而在 ios10 中它很好。
definesPresentationContext = true
上面的代码行是问题所在,它是有意写的 searchbar 当我导航到某个地方并返回时 UISearchController[ 不应该在那里=18=] 处于活动状态。但是根据我的要求,当 UISearchController 处于活动状态时,我无法选择导航。
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 集成。
最后我发现 solution.The 问题不是特定于设备的,ios 9 和 ios8 显示损坏的设计,而在 ios10 中它很好。
definesPresentationContext = true
上面的代码行是问题所在,它是有意写的 searchbar 当我导航到某个地方并返回时 UISearchController[ 不应该在那里=18=] 处于活动状态。但是根据我的要求,当 UISearchController 处于活动状态时,我无法选择导航。