在给定NSString::sizeWithAttributes
个属性的情况下,iOS 7使用NSString
来计算NSDictionary
的边界框的大小。但是,我找不到列出可用于NSDictionary
的所有枚举密钥的资源。
NSString UIKit Additions Reference说
这些属性可以应用于NSAttributedString对象
但没有列出它们,它们也没有列在NSAttributedString
documentation中。
另外:可用的属性键,哪个是调整多线标签的最基本的?似乎字体大小和换行模式是最重要的,但没有可用选项的列表,很难说...
答案 0 :(得分:16)
我搜索了20分钟,然后在发布在SO上后立即找到答案。叹息。
为了将来参考,可用属性列在NSAttributedString - Foundation Reference部分的Character Attributes底部。
答案 1 :(得分:8)
上面的链接已经死了。 Here is the new one
let NSAttachmentAttributeName: String
let NSBackgroundColorAttributeName: String
let NSBaselineOffsetAttributeName: String
let NSCursorAttributeName: String
let NSExpansionAttributeName: String
let NSFontAttributeName: String
let NSForegroundColorAttributeName: String
let NSKernAttributeName: String
let NSLigatureAttributeName: String
let NSLinkAttributeName: String
let NSMarkedClauseSegmentAttributeName: String
let NSObliquenessAttributeName: String
let NSParagraphStyleAttributeName: String
let NSShadowAttributeName: String
let NSSpellingStateAttributeName: String
let NSStrikethroughColorAttributeName: String
let NSStrikethroughStyleAttributeName: String
let NSStrokeColorAttributeName: String
let NSStrokeWidthAttributeName: String
let NSSuperscriptAttributeName: String
let NSTextAlternativesAttributeName: String
let NSTextEffectAttributeName: String
let NSToolTipAttributeName: String
let NSUnderlineColorAttributeName: String
let NSUnderlineStyleAttributeName: String
let NSVerticalGlyphFormAttributeName: String
let NSWritingDirectionAttributeName: String