首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iOS PopoVer NavigationBar不显示BarTintColor

iOS PopoVer NavigationBar不显示BarTintColor
EN

Stack Overflow用户
提问于 2015-04-28 08:35:04
回答 1查看 180关注 0票数 0

在我们的应用程序中,我们用下面的代码设置导航条和工具栏颜色。使用iOS 8.x,这是很好的工作方式。最近,我用iOS 7.x测试了这个应用程序,没有显示颜色。条形图是透明的,文本是白色的(所以这是有效的.)

代码语言:javascript
复制
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:255.0/255.0 green:167.0/255.0 blue:0.0/255.0 alpha:1.0]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

[[UIToolbar appearance] setBarTintColor:[UIColor colorWithRed:255.0/255.0 green:167.0/255.0 blue:0.0/255.0 alpha:1.0]];
[[UIToolbar appearance] setTintColor:[UIColor whiteColor]];

[[UINavigationBar appearance] setTitleTextAttributes:
 [NSDictionary dictionaryWithObjectsAndKeys:
  [UIColor whiteColor], NSForegroundColorAttributeName,
  [UIColor clearColor], UITextAttributeTextShadowColor,
  [NSValue valueWithUIOffset:UIOffsetMake(0, -1)], UITextAttributeTextShadowOffset,
  [UIFont boldSystemFontOfSize:19.0], NSFontAttributeName,
nil]];

我希望有人能解释我怎么解决这个问题。设置条形背景色对我来说不是解决办法,因为我会使用透明度。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-05-04 09:30:45

此问题的解决方案是再次在弹出ViewController中为iOS 7手动设置颜色值。

代码语言:javascript
复制
self.navigationController.toolbar.barStyle = UIBarStyleBlackTranslucent;
[self.navigationController.toolbar setTintColor:[UIColor whiteColor]];
[self.navigationController.toolbar setBarTintColor:[UIColor colorWithRed:255.0/255.0 green:167.0/255.0 blue:0.0/255.0 alpha:1.0]];

self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent; 
[self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
[self.navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:255.0/255.0 green:167.0/255.0 blue:0.0/255.0 alpha:1.0]];
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29914319

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档