0

I am customizing a UINavigationBar like so:

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

My original image background.png looks like this:

original

It has a flat color #4b0367

The resulting NavigationBar looks like this:

resulting bar

It has the color #311253 which is different from the original! Apparently UIKit changes the color.

Note:

  • Setting tintColor had no effect.
  • Setting a transparent background image + a color is not an appropriate solution in my case.

Does anybody know how the underlying mechanism works? How can I get the original image to appear correctly?

de.
  • 7,068
  • 3
  • 40
  • 69

0 Answers0