基本上,我有一个UIVIEwController,它呈现UISearchController,如下所示:
let searchController = UISearchController(searchResultsController: nil)searchController.searchResultsUpdater = selfsearchController.delegate = selfsearchController.dimsBackgroundDuringPresentation = falsesearchController.searchbar.delegate = selfvIEw.addSubvIEw(searchController.searchbar)
然后,用户需要点击UISearchbar来呈现searchController并显示键盘.然而,在控制器之间的过渡期间发生了奇怪的事情.
好像UISearchController似乎没有覆盖状态栏,让你看到下面提供它的UIVIEwController.我想找到一种方法来防止这种情况,即强制搜索控制器在状态栏下一直延伸.
我已经完成的事情:
>我在vIEwDIDLoad中设置了self.definesPresentationContext = true:
>我发现这是一个已知的错误,即rdar:// 20942583.
>我试图通过设置来规避错误:
self.edgesForExtendedLayout = .Allself.extendedLayoutIncludesOpaquebars = true
它没用.
我的想法已经不多了.请帮忙.
谢谢一堆,
皮特.
在我找到更好的解决方案之前,最好的解决方法(我知道很难看):
overrIDe func vIEwDIDLoad() { super.vIEwDIDLoad() searchController.delegate = self}func willPresentSearchController(searchController: UISearchController) { let statusHeight = UIApplication.sharedApplication().statusbarFrame.size.height if bgbar == nil { bgbar = UIVIEw(frame: CGRectMake(0,vIEw.frame.wIDth,(navigationController?.navigationbar.frame.height)! + statusHeight)) bgbar.backgroundcolor = UIcolor.redcolor() vIEw.addSubvIEw(bgbar) } else { bgbar.hIDden = false } tableVIEw.contentInset.top = statusHeight}func willdismissSearchController(searchController: UISearchController) { bgbar.hIDden = true tableVIEw.contentInset.top = 0}总结
以上是内存溢出为你收集整理的ios – UISearchController不包含带有不透明UINavigationBar的状态栏全部内容,希望文章能够帮你解决ios – UISearchController不包含带有不透明UINavigationBar的状态栏所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)