[英]uisearchbar navigation bar color & status color
I am using uisearchbarcontroller. 我正在使用uisearchbarcontroller。 When search bar is active, status bar become grey color instead of original navigation bar color.
当搜索栏处于活动状态时,状态栏变为灰色,而不是原始的导航栏颜色。 May I know why it happen like that?
我可以知道为什么会这样吗? Below is the code for how I set navigation bar color.
以下是我如何设置导航栏颜色的代码。
[self setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
{
self.barTintColor = [Helpers getThemeColor:type];
break;
}
[self setBackgroundColor:[Helpers getThemeColor:type]];
self.opaque = YES;
You have to set UISearchBar backgroundColor to color you want. 您必须将UISearchBar backgroundColor设置为所需的颜色。
Example:-- searchn.backgroundColor=uicolor; 示例:-searchn.backgroundColor = uicolor;
UISearchbarcontroller
presents search controller modally this causes change in status bar color. UISearchbarcontroller
以模态形式显示搜索控制器,这会导致状态栏颜色发生变化。 add code below to reset status bar color and then set background color for UISearchBar 在下面添加代码以重置状态栏颜色,然后为UISearchBar设置背景颜色
[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackOpaque];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.