作为UIAlertAction的标题NSMutableAttributedString Swift
问题描述:
是否有可能将NSMutableAttributedString设置为AlertAction的标题? 我的目标是在UIAlertAction的标题中用一个好的设计形象化数学表达式。作为UIAlertAction的标题NSMutableAttributedString Swift
let action = UIAlertAction(title: myNSMutableAttributedString, style: UIAlertActionStyle.default) {(result : UIAlertAction) -> Void in
}
在此先感谢您的帮助。
答
这不可能使用的NSAttributedString
一个UIAlertAction
的标题,而无需访问私有API,因为该方法为attributedTitle
设置为一个属性串不在这里工作了(see this question for details on that)。
我会创建一个自定义类或为此使用一个警报库。
Sooo你怎么试试? – LinusGeffarth
我把标题:String(描述:myNSMutableAttributedString)但显然不是好的方法 – Carlo