问题
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:
It has a flat color #4b0367
The resulting NavigationBar looks like this:
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?
来源:https://stackoverflow.com/questions/16190127/custom-uinavigationbar-background-image-appears-darker-than-the-original-image