【问题标题】:tintcolor for navigationBar导航栏的 tintcolor
【发布时间】:2010-01-17 04:29:25
【问题描述】:

当我使用以下代码设置 tintcolor 时,它可以工作

self.navigationController.navigationBar.tintColor = [UIColor brownColor];

但是当我尝试将色调设置为 - ` UIImage *navigationBarCol = [UIImage imageNamed:@"navigatorBar_color.png"];

self.navigationController.navigationBar.tintColor = [UIColor colorWithPatternImage:navigationBarCol]; ` 然后它不显示确切的颜色,只显示黑色阴影。 navigationBar_color.png 是我要设置的颜色的单像素图​​像。 我正在使用此方法在我的程序中设置表格行或其他对象的颜色,并且效果很好。

此外,UIColor colorWithPatternImage 方法应该返回 UIColor,所以这两种方法看起来也与我相似。你能告诉我为什么第二种方法不适用于 navigatiorBar。

【问题讨论】:

    标签: iphone uinavigationbar tint


    【解决方案1】:

    NavigationBars 和控件上的 tintColor 仅作为计算控件中使用的渐变的基础。你不能很好地拥有渐变图像,所以它只是使用它的一部分。听起来您想要的是 UINavigationBar 的自定义子类,具有覆盖的 drawRect: 方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多