Ade*_*aer 7 uistatusbar uisearchresultscontroller appdelegate ios8 uisearchcontroller
嗨,这是我的问题:
在我的AppDeleagate的 didFinishLaunchingWithOptions:方法我有一个方法[self configureUINavigationControllerStlyle]; 它配置状态栏和我的应用程序的所有导航栏外观(我的UINavigationController和UITabbarController在我的应用程序中一起工作).
-(void) configureUINavigationControllerStlyle {
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UINavigationController *navigationController = (UINavigationController *)[tabBarController.viewControllers objectAtIndex:0];
navigationController.navigationBar.translucent = NO;
[[UINavigationBar appearance] setBarTintColor: [CustomColor getAwesomeColor:@"colorBlue3_1"]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setTitleTextAttributes:@{
NSForegroundColorAttributeName : [UIColor whiteColor],
NSFontAttributeName: [UIFont fontWithName:@"AvenirNext-DemiBold" size:17.0]
}];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
Run Code Online (Sandbox Code Playgroud)
另外在我的info.plist中我设置:查看基于控制器的状态栏外观为"NO"
一切都很好,我的应用程序中的所有控制器都有蓝色背景和白色文本颜色的状态栏.但不是uisearchcontroller和uisearchresultscontroller.
我的根TableViewController看起来像这样:
https://www.dropbox.com/s/oqcozos89x9yqhg/Screen%20Shot%202014-12-11%20at%2016.21.06.jpg?dl=0
我在我的应用程序中集成了searchController和searchResultsController.逻辑运行良好,但我不明白如何处理searchController和searchResultController中的状态栏外观.他们不使用我在AppDelegate.m文件中创建的状态栏的样式.
我的searchController和searchResultsController看起来像这样(状态栏变为白色,状态栏的文本颜色也变为白色,但我需要我的状态栏与我的主视图控制器中的颜色相同(蓝色背景和白色文本颜色).
https://www.dropbox.com/s/26skdz7gvehmwl4/Screen%20Shot%202014-12-11%20at%2016.21.16.png?dl=0
另一个错误:当我使用时
navigationController.navigationBar.translucent = NO;
Run Code Online (Sandbox Code Playgroud)
在我的AppDelegate中 - 在使用搜索控制器后从详细视图控制器返回时,它会导致我的家庭桌面视图"跳跃或拉伸".当我没有设置半透明属性时 - 没有"跳跃".
也许有人知道如何在iOS 8中使用searchController时修复状态栏颜色问题.
如果我使用默认颜色(不要对我的AppDelegate添加任何更改),一切正常,但我需要在我的应用程序中自定义状态栏颜色.
你需要像这样子类化UISearchController
和覆盖preferredStatusBarStyle
:
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
Run Code Online (Sandbox Code Playgroud)
如果您希望状态栏中出现白色文本,info.plist
请确保已将其Status bar style
设置为Opaque black style
或Transparent black style
。
这应该适用于您的其余代码。
归档时间: |
|
查看次数: |
1439 次 |
最近记录: |