Custom UINavigationBar background image appears darker than the original image
Asked Answered
H

0

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?

Henryk answered 24/4, 2013 at 10:54 Comment(4)
where you kept this one in appdelegate or viewcontroller?Desuetude
The code above sits in application:didFinishLaunchingWithOptions:, so in AppDelegate.Henryk
You find any solution for it?Nimble
unfortunately, i didn't.Henryk

© 2022 - 2024 — McMap. All rights reserved.