繁体   English   中英

如何更改NSMutableAttributedString的默认字体和字体大小

[英]how to change the default font and font size of NSMutableAttributedString

我用的很快。 有什么方法可以更改NSMutableAttributedString的默认字体/字体大小等吗? 显然,我可以为给定范围专门设置这些值-但这将覆盖字符串中的任何特定设置。

你可以这样使用

let yourAttributes = [NSFontAttributeName: UIFont.preferredFontForTextStyle(UIFontTextStyleHeadline), NSForegroundColorAttributeName: UIColor.blackColor()]

let yourString = NSAttributedString(string: "Here my string !", attributes: yourAttributes)

谢谢

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM