My situation is that I want to change the background color of the alerts as well as the text. I've seen some examples, but they don't appear to be working anymore. Here is what I've tried:
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
alert.addAction(UIAlertAction(title: btnTitle, style: UIAlertActionStyle.default, handler: nil))
self.present(alert, animated: true, completion: nil)
let subview :UIView = alert.view.subviews.last! as UIView
let alertContentView = subview.subviews.last! as UIView
alertContentView.backgroundColor = UIColor.black
I have also tried to do this:
alert.view.backgroundColor = UIColor.black
and also putting them in the completion handlers, but it doesn't appear to be working like previous versions. What is appearing instead is the alert with the usual rounded corners and outside the rounded corners, the black background appears in the back to make the alert a square box (normally its rounded and the part where the black is showing would be transparent). The color just won't go over the alert's white color.