【发布时间】:2014-10-14 19:56:10
【问题描述】:
目前我正在尝试将 UISearchController 嵌入到我的应用程序中。但是,如果 UINavigationBar 是非半透明的,作为 UISearchController 的属性的 UISearchBar 将无法正确显示。通常在点击 UISearchBar 属性后,UINavigationBar 会向上移动以为 UISearchBar 腾出空间。您可以在以下屏幕截图中看到结果:
https://www.dropbox.com/s/172k63zr2bhj84t/Normal_behaviour.png?dl=0
但如果 UINavigationBar 的“translucent”属性设置为“NO”,则 UISearchBar 无法正常显示,因为状态栏的背景保持透明,如下图所示:
https://www.dropbox.com/s/v5cnxoj9ms6976r/Wrong_behaviour.png?dl=0
为了演示这种奇怪的行为,我修改了 Apple 提供的示例项目:
https://developer.apple.com/library/ios/samplecode/TableSearch_UISearchController/Introduction/Intro.html
在这里你可以下载修改后的版本:
https://www.dropbox.com/s/7icfe6kap98g1e8/TableSearchwithUISearchControllerObj-CandSwift_MODIFIED.zip?dl=0
修改在文件“APLMainTableViewController.m”第33行。
【问题讨论】:
-
是的,我也看到了。非常令人沮丧。
-
截图不存在。你能再上传一次吗?
标签: ios cocoa-touch uikit uinavigationbar uisearchcontroller