【发布时间】:2015-08-19 13:51:14
【问题描述】:
我正在使用 Xcode 7。当使用带有自定义字体的属性文本时,它会显示在情节提要中,但无法在设备上运行。我尝试了以下代码:
var myMutableString = NSMutableAttributedString()
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 8
paragraphStyle.alignment = NSTextAlignment.Center
myMutableString = NSMutableAttributedString(string: "\"Taking out my shorts and T-Shirt a night before has helped create a great morning routine for my walk\"", attributes: [NSFontAttributeName:UIFont(name: "Gotham Medium", size: 20.0)!])
myMutableString.addAttribute(NSParagraphStyleAttributeName, value:paragraphStyle, range:NSMakeRange(0, myMutableString.length))
quotesLabel.attributedText = myMutableString
【问题讨论】:
标签: swift nsattributedstring swift2 xcode7