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

更改UIAlertAction';的字体大小时出错;iOS中使用Swift的UIAlertController的按钮标题,swift,ios9,uialertcontroller,uialertaction,Swift,Ios9,Uialertcontroller,Uialertaction,我得到以下错误: “[setValue:forUndefinedKey:]:该类不符合密钥_attributedTitle的键值编码。” 请告诉我更改UIAlertAction按钮标题字体大小的正确键值 感谢您的帮助 它是attributedtille而不是attributedtille。此外,它还用于赋予属性化标题而不是attibuted action。@NiravDoctorwala我也使用了attributedTitle,但没有解决该问题:(这是针对AlertController titl

我得到以下错误:

“[setValue:forUndefinedKey:]:该类不符合密钥_attributedTitle的键值编码。”

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


感谢您的帮助

它是attributedtille而不是attributedtille。此外,它还用于赋予属性化标题而不是attibuted action。@NiravDoctorwala我也使用了attributedTitle,但没有解决该问题:(这是针对AlertController title而非action的。如果您想更改按钮标题颜色,可以使用alertVC.view.tintColor=您的颜色;OP想更改
UIAlertAction
的字体系列和大小,而不是颜色。它是attributedTitle not\u attributedTitle。它还可用于指定属性标题not Attibuted action。@NiravDoctorwala我也使用了attributedTitle,但没有解决这个问题:(即用于AlertController标题而非操作如果您想更改按钮标题颜色,可以使用alertVC.view.tintColor=您的颜色;OP想更改
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)