【问题标题】:setting UINavigationBar tintColor only sets it's back button color设置 UINavigationBar tintColor 只设置它的后退按钮颜色
【发布时间】:2012-02-07 22:37:57
【问题描述】:

所以我正在设置 UINavigationBar tintColor,这就是我得到的:

[navController.navigationBar setTintColor:[UIColor whiteColor]];

这怎么可能?如果有帮助,这里有更多信息:

【问题讨论】:

    标签: iphone objective-c ipad uinavigationcontroller uinavigationbar


    【解决方案1】:

    我有一个UINavigationController,我自定义如下:

    首先,想出一个 44 像素高的图像作为导航栏的背景。 (在这种情况下,如果您想使用 44 像素高的白色图像,那就可以了 --- 但如果您使用某种类型的垂直渐变,效果会更好)

    其次,在您的AppDelegatedidFinishLaunching 方法中使用以下代码。 (图片名为“background_44.png”。

    // Set the background image for *all* UINavigationBars
        UIImage *gradientImage44 = [[UIImage imageNamed:@"background_44.png"]
                                    resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
    
    // Set the background image for *all* UINavigationBars
        [[UINavigationBar appearance] setBackgroundImage:gradientImage44 
                                               forBarMetrics:UIBarMetricsDefault];
    

    【讨论】:

    【解决方案2】:

    我在我的项目中删除了该代码,工作正常。甚至改变了酒吧的风格和颜色。没问题。这行代码没问题,其他地方有问题或者是一些疯狂的故障。

    【讨论】:

      猜你喜欢
      • 2013-08-30
      • 2012-06-16
      • 1970-01-01
      • 1970-01-01
      • 2019-11-05
      • 2011-01-12
      • 2017-01-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多