UINavigationBar + UIAppearance: not possible to restore standard blurred look
| Originator: | futuretap | ||
| Number: | rdar://16898794 | Date Originated: | 13-May-2014 06:25 PM |
| Status: | Open | Resolved: | |
| Product: | iOS SDK | Product Version: | 7.1 |
| Classification: | UI/Usability | Reproducible: | Always |
I’ve defined a background image for all UINavigationBar’s using the appearance proxy: [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"myNavBar"] forBarMetrics:UIBarMetricsDefault]; Now I want to exclude specific navigation bars where I want to restore the standard blurred look: [[UINavigationBar appearanceWhenContainedIn:MyNavigationController.class, nil] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; This does not work. Instead of getting back the original look with the blurred background, I get a completely transparent navigation bar. IMO, setting a nil backgroundImage should restore the original look. Should I actually want a clear background, I’d rather specify a clear UIImage.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Workaround
The case is actually a bit more complicated. My code is:
in this case, the last line sets a clear background instead of the default background. If I also add
it works and I get the blurred look in "MyNavigationController". So apparently, I have to override the image for all barMetrics, even though I don't actually need a prompted navigation bar for the excluded case.