在iOS中使用Swift更改UIAlertAtroller的UIAlertController按钮标题的字体大小时出错

时间:2016-06-09 14:13:10

标签: swift ios9 uialertcontroller uialertaction

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:]:此类与key _attributedTitle不符合键值编码。'

请告诉我更改UIAlertAction按钮标题字体大小的正确键值。

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

0 个答案:

没有答案