1
let alertController: UIAlertController = UIAlertController(title: "Alert", message: nil, preferredStyle: .ActionSheet)

let customActionButton: UIAlertAction = UIAlertAction(title: "Custom", style: .Default) { action -> Void in

}
let attrString: NSAttributedString = NSAttributedString(string: "Custom", attributes: [NSFontAttributeName: UIFont.init(name: "Roboto-Regular", size: 17.0)!])
customActionButton.setValue(attrString, forKey: "attributedTitle")
alertController.addAction(customActionButton)

self.presentViewController(alertController, animated: true, completion: nil)

我收到以下错误:

'[ setValue:forUndefinedKey:]: 这个类不符合键 _attributedTitle 的键值编码。

请让我知道更改 UIAlertAction 按钮标题的字体大小的正确键值是什么。

任何帮助表示赞赏..!!

4

0 回答 0