作为UIAlertAction的标题NSMutableAttributedString Swift

问题描述:

是否有可能将NSMutableAttributedString设置为AlertAction的标题? 我的目标是在UIAlertAction的标题中用一个好的设计形象化数学表达式。作为UIAlertAction的标题NSMutableAttributedString Swift

let action = UIAlertAction(title: myNSMutableAttributedString, style: UIAlertActionStyle.default) {(result : UIAlertAction) -> Void in 

} 

在此先感谢您的帮助。

+0

Sooo你怎么试试? – LinusGeffarth

+0

我把标题:String(描述:myNSMutableAttributedString)但显然不是好的方法 – Carlo

不可能使用的NSAttributedString一个UIAlertAction的标题,而无需访问私有API,因为该方法为attributedTitle设置为一个属性串不在这里工作了(see this question for details on that)。

我会创建一个自定义类或为此使用一个警报库。

+0

感谢您的答案。关于良好警报库的一些想法? – Carlo

+0

尝试[SCLAlertView](https://github.com/vikmeup/SCLAlertView-Swift)。 – the4kman

+0

好的,非常感谢。再见 – Carlo