// // CLAlertController.swift // Inhealth // // Created by weclouds on 2019/12/29. // Copyright © 2019 weclouds. All rights reserved. // import UIKit class CLAlertController: UIAlertController{ override func viewDidLoad() { super.viewDidLoad() // let titleStr = "Choose a photo" // let titleAttrString = NSMutableAttributedString(string: titleStr) // //to change font of title and message. // let titleFont = [NSAttributedString.Key.font: UIFont(name: Alibaba_PuHuiTi_Bold, size: 18.0)!] // let titleColor = [NSAttributedString.Key.foregroundColor: UIColor(hexString: "333333")] // // titleAttrString.addAttributes(titleFont, range: NSRange(location: 0, length: titleStr.count)) // titleAttrString.addAttributes(titleColor, range: NSRange(location: 0, length: titleStr.count)) // self.setValue(titleAttrString, forKey: "attributedTitle") } override func addAction(_ action: UIAlertAction) { super.addAction(action) if action.style == .default { action.setValue(UIColor(hexString: "333333"), forKey: "titleTextColor") }else if action.style == .cancel{ action.setValue(UIColor(hexString: "#C6CDD5"), forKey: "titleTextColor") } } }