【发布时间】:2019-02-23 08:02:06
【问题描述】:
有没有办法改变 UIAlertAction 字体,因为我只在 UIAlertController 的标题和消息中找到了如何改变字体。我还找到了如何更改颜色,但我只是找不到如何更改字体的方法。
【问题讨论】:
标签: objective-c swift uialertcontroller uialertaction
有没有办法改变 UIAlertAction 字体,因为我只在 UIAlertController 的标题和消息中找到了如何改变字体。我还找到了如何更改颜色,但我只是找不到如何更改字体的方法。
【问题讨论】:
标签: objective-c swift uialertcontroller uialertaction
let titleAttributed = NSMutableAttributedString(
string: Constant.Strings.cancelAbsence,
attributes: [NSAttributedStringKey.font:UIFont(name:"FONT_NAME",size: FONT_SIZE)]
)
let messageAttributed = NSMutableAttributedString(
string: Constant.Strings.cancelAbsence,
attributes: [NSAttributedStringKey.font:UIFont(name:"FONT_NAME",size: FONT_SIZE)]
)
let alertController = UIAlertController(
title: "",
message: "",
preferredStyle: UIAlertControllerStyle.YOUR_STYLE
)
alertController.setValue(titleAttributed, forKey : "attributedTitle")
alertController.setValue(messageAttributed, forKey : "attributedMessage")
present(alertController, animated: true, completion: nil)
【讨论】: