iOS 7,范围栏在搜索模式下变黑 [英] iOS 7, scope bar becomes black in search mode

查看:28
本文介绍了iOS 7,范围栏在搜索模式下变黑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用嵌入到 UiTableViewController 的 UISearchDisplayController 在我的表格视图中创建一个搜索栏.但是如果我设置了搜索栏的背景图片,范围栏就不会在搜索模式下显示,而是显示一个黑条.这很奇怪,因为它不会在 iOS 6 中发生.

I use UISearchDisplayController embedded to UiTableViewController to make a search bar in my table view. But if I set the search bar's background image, the scope bar do not show in search mode, but showing a black bar instead. It's very weird because it does not happen in iOS 6.

请注意,我用来设置搜索栏背景图片的图片是 640x90 像素,如果使用其他图片,范围栏会以某种方式显示.

Note that the image I used to set the search bar's background image is 640x90 px, somehow the scope bar will show if use other image.

即使我设置了范围栏背景图片,它仍然不会显示取决于搜索栏的图片设置.

Even if I set the scope bar background image, it sill not show depend on the search bar's image setting.

我认为这是iOS 7的一个bug,为了防止其他因素,我什至在Xcode 5中使用了master-detail模板,并在主视图控制器中嵌入了UISearchDisplayController,更改了搜索栏背景图像和范围栏显示搜索模式下为黑色.

I think it's a bug in iOS 7, and to prevent from other factors, I even use the master-detail template in Xcode 5, and embed the UISearchDisplayController in master view controller, change the search bar background image and scope bar shows black in search mode.

我认为这与 iOS 7 自动调整视图控制器大小有关.让我很困扰.

I think it has something to do with iOS 7 auto resize of view controller. Bothers me so much.

有人请尝试帮助.非常感谢.

Someone please try and help. Thanks a lot a lot.

------------------------------已编辑--------------------------有时,如果我更改搜索栏背景图片,范围栏会显示,但在真实设备(iPhone5)中,范围栏从不显示.

------------------------------edited-------------------------- Sometimes the scope bar will show if I change search bar background image, but in real device (iPhone5), the scope bar never show.

推荐答案

我刚刚在这里找到了一个解决方案:IOS7状态栏在搜索激活后变为黑色

I have just found a solution here: IOS7 Status bar change to black after search is active

只需将这两行放在您的表视图控制器 (viewDidLoad) 上:

Just put these two lines on your table view controller (viewDidLoad):

self.navigationController.view.backgroundColor = [UIColor whiteColor]; 

self.navigationController.navigationBar.translucent = NO;

其中whiteColor"是状态栏所需的颜色.

Where "whiteColor" is the color that you need for the status Bar.

这篇关于iOS 7,范围栏在搜索模式下变黑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆