【发布时间】:2016-10-19 23:18:05
【问题描述】:
我想用 Swift 更改消息框 title 和 message 的 字体大小。
我不想要字体颜色或字体系列。我只想改变字体大小和行高。
let attributedString = NSAttributedString(string: "Title", attributes: [
NSFontAttributeName : UIFont.systemFontOfSize(15) //your font here,
NSForegroundColorAttributeName : UIColor.redColor()])
let alert = UIAlertController(title: "", message: "", preferredStyle: .Alert)
alert.setValue(attributedString, forKey: "attributedTitle")
let cancelAction = UIAlertAction(title: "Cancel",
style: .Default) { (action: UIAlertAction!) -> Void in
}
presentViewController(alert,
animated: true,
completion: nil)
【问题讨论】:
-
你使用的iOS版本
-
我的开发目标是9.0
标签: swift uialertview font-size uialertcontroller