I'm using MFMailComposeViewController and I'd like to change background color so it matches the one I have across the app. I've tried several things, but nothing worked(at least not on iOS 9).
let mailVC = MFMailComposeViewController()
mailVC.mailComposeDelegate = self
...
mailVC.navigationBar.titleTextAttributes =
[NSForegroundColorAttributeName: UIColor.whiteColor()] // this works
mailVC.navigationBar.tintColor = UIColor.whiteColor() // this works
mailVC.navigationBar.barTintColor = UIColor.blueColor() // this doesn't work
mailVC.navigationBar.backgroundColor = UIColor.blueColor() // this doesn't work
Background color stays default gray.
I solved it by setting color of navigationbar before initializing MFMailComposeViewController
like this:
UINavigationBar.appearance().barTintColor = UIColor.blueColor()
let mailVC = MFMailComposeViewController()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With