I'm new on iOS development.
I'm trying to change the title and message color of a UIAlertController but is not working, the color is not changing.
Here is my code:
let alert = UIAlertController(title: NSLocalizedString("notifications_popup2_title", comment: ""), message: NSLocalizedString("notifications_popup2_message", comment: ""), preferredStyle: UIAlertControllerStyle.actionSheet)
// Change font of the title and message
let titleFont:[NSAttributedStringKey : AnyObject] = [ NSAttributedStringKey(rawValue: NSAttributedStringKey.font.rawValue) : UIFont(name: "Flama-Basic", size: 22)!, NSAttributedStringKey(rawValue: NSAttributedStringKey.foregroundColor.rawValue) : UIColor(hexString: "#2e2e2e")! ]
let messageFont:[NSAttributedStringKey : AnyObject] = [ NSAttributedStringKey(rawValue: NSAttributedStringKey.font.rawValue) : UIFont(name: "Flama-light", size: 18)!, NSAttributedStringKey(rawValue: NSAttributedStringKey.foregroundColor.rawValue) : UIColor(hexString: "#2e2e2e")! ]
let attributedTitle = NSMutableAttributedString(string: NSLocalizedString("notifications_popup2_title", comment: ""), attributes: titleFont)
let attributedMessage = NSMutableAttributedString(string: NSLocalizedString("notifications_popup2_message", comment: ""), attributes: messageFont)
alert.setValue(attributedTitle, forKey: "attributedTitle")
alert.setValue(attributedMessage, forKey: "attributedMessage")
If i change alert style to .alert
it is working...