extension UIAlertController{
open override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
for i in self.actions {
let attributedText = NSAttributedString(string: i.title ?? "", attributes: [NSAttributedString.Key.font : UIFont(name: "SFProText-Semibold", size: 20.0)!])
guard let label = (i.value(forKey: "__representer") as AnyObject).value(forKey: "label") as? UILabel else { return }
label.attributedText = attributedText
}
}
}
iOS 修改UIAlertAction的字体大小一般来说,如果需要修改UIAlertController的标题(title)、内容(message)的字体和颜色,可以利用KVC来实现:参考链接:http://www.jia...