【发布时间】:2016-02-01 22:13:02
【问题描述】:
如何在 AlertView 中更改“消息”中单词的颜色
@@IBAction func btn_instructions(sender: UIButton) {
let alertView = UNAlertView(title: "MyTitle", message: "Here green text, here red text")
alertView.show()
如果问题不正确,请见谅。
【问题讨论】:
-
请注意
UIAlertView在 iOS9 中已被弃用(我假设上面的UNAlertView是一个错字)。您应该改用UIAlertController。 -
@LeoDabus 实际上,它确实具有属性文本属性,
"attributedTitle"和"attributedMessage"分别用于标题和消息文本。但是,据我所知,Apple 没有记录这些内容;我只能通过runtime introspection 找到用户引用的它们。 -
UIAlertAction 是否也有“attributedTitle”?