我正在尝试更改 中的标题fontSize,UIAlertController但我无法管理如何将我NSMutableAttributedString的设置为title-property。
因此,我一直在NSMutableAttributedString使用以下代码创建:
let title = NSMutableAttributedString(string: user.fullName)
let range = NSRange(location: 0, length: title.length)
title.addAttribute(NSAttributedStringKey.font, value: UIFont.TextStyle.largeTitle, range: range)
现在对我来说棘手的部分是如何弄清楚如何将新标题设置为UIAlertController,因为它需要一个String?值。
我环顾四周,发现UILabel在展示UIAlertController. 但是如何用我自己的自定义覆盖title-property ?UIAlertControllerUILabel
present(myUIAlertController, animated: true) {
// Creating the UILabel depending on string length
// Set the NSMutableAttributedString value to the custom UILabel and override title property.
}
或者也许有更简单的方法来解决这个问题?

