我的项目中有一个alert
。 alert
与其他每个警报一样简单。我想改变font style and color
。怎么可能?
提前致谢!
答案 0 :(得分:0)
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)
答案 1 :(得分:0)
你可以使用SweetAlert
SweetAlert().showAlert("Here's a message!", subTitle: "It's pretty, isn't it?", style: AlertStyle.None)
完整文档&实施链接:https://github.com/codestergit/SweetAlert-iOS