见下文:
// Description (HTML string):
var attrStr = NSMutableAttributedString(
data: formatted.dataUsingEncoding(NSUnicodeStringEncoding, allowLossyConversion: true)!,
options: [ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType],
documentAttributes: nil,
error: nil)
var paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = NSTextAlignment.Justified
attrStr?.addAttribute(NSParagraphStyleAttributeName, value: paragraphStyle, range: NSMakeRange(0, attrStr!.length))
attrStr?.addAttribute(NSKernAttributeName, value: -0.1, range: NSMakeRange(0, attrStr!.length))
descLabel.attributedText = attrStr
descLabel.sizeToFit()
Run Code Online (Sandbox Code Playgroud)
到目前为止,我试图证明文本的合理性,导致了同样的行为.我已经通过内联式CSS int eh html文本或使用textAlignment属性尝试过.
问题是,证明文本的合理性会打破字母间距(实际上它会增加每个单词的跟踪/字距,而不是仅增加其间的空间).
看到:

我想看到一个不是黑客的解决方案,因为我已经设计了一些我自己的黑客,但后来我陷入了其他问题的太多可能性.
我错过了一些简单的东西?我已经浏览了所有UI选项,并且在我的代码示例中看到,我甚至尝试更改Kern,它确实发生了变化但只是按比例变化(即它仍然增加).