【发布时间】:2016-08-20 16:48:13
【问题描述】:
我对这个问题进行了很多研究,但没有找到适合我的解决方案。
基本上,我有一个UIViewController,它像这样呈现UISearchController:
let searchController = UISearchController(searchResultsController: nil)
searchController.searchResultsUpdater = self
searchController.delegate = self
searchController.dimsBackgroundDuringPresentation = false
searchController.searchBar.delegate = self
view.addSubview(searchController.searchBar)
然后预计用户点击UISearchBar 以呈现searchController 并显示键盘。然而,在控制器之间的转换过程中发生了一件奇怪的事情。
似乎UISearchController 没有覆盖状态栏,让您看到下面显示的UIViewController。 我想找到一种方法来防止这种情况发生,即强制搜索控制器一直延伸到状态栏下方。
我已经做过的事情:
- 我在
viewDidLoad:中设置了self.definesPresentationContext = true。 - 我发现这是一个已知的bug,即rdar://20942583。
-
我试图通过设置来规避这个错误:
self.edgesForExtendedLayout = .All self.extendedLayoutIncludesOpaqueBars = true没用。
我的想法已经不多了。请帮忙。
非常感谢, 皮特。
【问题讨论】:
标签: ios swift uisearchbar uisearchcontroller