2017-09-03 63 views
0

是否有可能將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

回答

2

不可能使用的NSAttributedString一個UIAlertAction的標題,而無需訪問私有API,因爲該方法爲attributedTitle設置爲一個屬性串不在這裏工作了(see this question for details on that)。

我會創建一個自定義類或爲此使用一個警報庫。

+0

感謝您的答案。關於良好警報庫的一些想法? – Carlo

+0

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

+0

好的,非常感謝。再見 – Carlo

相關問題