【发布时间】:2017-07-11 09:14:55
【问题描述】:
我的项目中有一个alert。 alert 和其他警报一样简单。我想更改font style and color。这怎么可能?
提前致谢!
【问题讨论】:
我的项目中有一个alert。 alert 和其他警报一样简单。我想更改font style and color。这怎么可能?
提前致谢!
【问题讨论】:
let attributedString = NSAttributedString(string: "YourTitle", attributes: [
NSFontAttributeName : UIFont.systemFontOfSize(18), //your font here
NSForegroundColorAttributeName : UIColor.black()
])
let alert = UIAlertController(title: "TextTitle", message: "YourMessage", preferredStyle: .Alert)
alert.setValue(attributedString, forKey: "attributedTitle")
let cancelAction = UIAlertAction(title: "Cancel",
style: .Default) { (action: UIAlertAction!) -> Void in
}
presentViewController(alert,
animated: true,
completion: nil)
【讨论】:
您可以使用 SweetAlert
SweetAlert().showAlert("Here's a message!", subTitle: "It's pretty, isn't it?", style: AlertStyle.None)
【讨论】: