【问题标题】:custom UIColor for my navigationbar我的导航栏的自定义 UIColor
【发布时间】:2014-04-03 21:52:22
【问题描述】:

我正在尝试将导航栏和状态栏设置为“color5”

UIColor* color5 = [UIColor colorWithRed: 0.114 green: 0.705 blue: 1 alpha: 1];

我将导航栏设为属性并尝试设置色调颜色:

navBar.tintColor = color5;

但这没有用。 我也尝试在 AppDelegate 中这样做:

[[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x067AB5)];

这可行,但没有将导航栏设置为我想要的颜色,只设置了导航栏,而不是状态栏。我试图找出我的 UIColor 的十六进制数,但我无法弄清楚。我认为问题在于它有小数,但它可以很好地设置我正在使用的按钮。 非常感谢您的帮助。

【问题讨论】:

    标签: xcode5 uinavigationbar uicolor ios7.1 uistatusbar


    【解决方案1】:

    你可以用这个

    if (IOS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0"))
        {
            [[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]];
        } else
        {
            [[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
            [[UINavigationBar appearance] setBackgroundColor:[UIColor whiteColor]];
        }
    

    【讨论】:

      猜你喜欢
      • 2011-07-27
      • 2012-03-12
      • 1970-01-01
      • 2015-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多