IOS 9: Background image for UINavigationBar not working

I have a global background image (mostly orange) that is configured for all navigation panels inside AppDelegate:

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"order-navbar"] forBarMetrics:UIBarMetricsDefault]; 

This works for all kinds except one: I have an MFMailComposeViewController whose background in the navigation bar remains gray-white, regardless of what I do:

 let mailController = MFMailComposeViewController() mailController.navigationBar.tintColor = UIColor.whiteColor() // this works emailController.navigationBar.setBackgroundImage(UIImage(named: "order-navbar") forBarMetrics:UIBarMetrics.Default) // this does not UINavigationBar.appearance().setBackgroundImage(UIImage(named: "order-navbar") forBarMetrics:UIBarMetrics.Default) // this does neither 

However, sometimes the mail controller first appears with an orange bar, and then again changes its color to white-gray.

On iOS 8, everything works. Is this an iOS 9 bug?

+5
source share

Source: https://habr.com/ru/post/1231960/


All Articles