-->

自UINavigationBar的背景图像会比原始图像暗(Custom UINavigationBa

2019-09-01 01:21发布

我定制像这样一个UINavigationBar的:

UIImage * img = [UIImage imageNamed:@"background.png"];
[[UINavigationBar appearance] setBackgroundImage:img forBarMetrics:UIBarMetricsDefault];

我原来的图像background.png看起来是这样的:

它有一个平坦的颜色#4b0367

得到的导航栏是这样的:

它具有颜色#311253是从原来的不同! 显然UIKit中改变颜色。

注意:

  • 设置tintColor没有影响。
  • 设置透明背景图像+一颜色不是在我的情况适当的解决方案。

有谁知道的基本机制是如何工作的? 我怎样才能得到原始图像正常显示?

文章来源: Custom UINavigationBar background image appears darker than the original image