// Predefined character attributes for text. If the key is not in the dictionary, then use the default values as described below.
//字体大小
NSString * const NSFontAttributeName; // UIFont, default Helvetica(Neue) 12
//段落样式
NSString * const NSParagraphStyleAttributeName; // NSParagraphStyle, default defaultParagraphStyle
//字体颜色
NSString * const NSForegroundColorAttributeName; // UIColor, default blackColor
//字体背景色
NSString * const NSBackgroundColorAttributeName; // UIColor, default nil: no background
//连字符
NSString * const NSLigatureAttributeName ; // NSNumber containing integer, default 1: default ligatures, 0: no ligatures
//字间距
NSString * const NSKernAttributeName ; // NSNumber containing floating point value, in points; amount to modify default kerning. 0 means kerning is disabled.
//删除线
NSString * const NSStrikethroughStyleAttributeName ; // NSNumber containing integer, default 0: no strikethrough
//下划线
NSString * const NSUnderlineStyleAttributeName ; // NSNumber containing integer, default 0: no underline
//边线颜色
NSString * const NSStrokeColorAttributeName ; // UIColor, default nil: same as foreground color
//边线宽度
NSString * const NSStrokeWidthAttributeName ; // NSNumber containing floating point value, in percent of font point size, default 0: no stroke; positive for stroke alone, negative for stroke and fill (a typical value for outlined text would be 3.0)
//阴影
NSString * const NSShadowAttributeName ; // NSShadow, default nil: no shadow
NSString *const NSTextEffectAttributeName ; // NSString, default nil: no text effect
NSString * const NSAttachmentAttributeName ; // NSTextAttachment, default nil
NSString * const NSLinkAttributeName ; // NSURL (preferred) or NSString
NSString * const NSBaselineOffsetAttributeName ; // NSNumber containing floating point value, in points; offset from baseline, default 0
NSString * const NSUnderlineColorAttributeName ; // UIColor, default nil: same as foreground color
NSString * const NSStrikethroughColorAttributeName ; // UIColor, default nil: same as foreground color
NSString * const NSObliquenessAttributeName ; // NSNumber containing floating point value; skew to be applied to glyphs, default 0: no skew
NSString * const NSExpansionAttributeName ; // NSNumber containing floating point value; log of expansion factor to be applied to glyphs, default 0: no expansion
NSString * const NSWritingDirectionAttributeName NS_AVAILABLE(10_6, 7_0); // NSArray of NSNumbers representing the nested levels of writing direction overrides as defined by Unicode LRE, RLE, LRO, and RLO characters. The control characters can be obtained by masking NSWritingDirection and NSTextWritingDirection values. LRE: NSWritingDirectionLeftToRight|NSWritingDirectionEmbedding, RLE: NSWritingDirectionRightToLeft|NSWritingDirectionEmbedding, LRO: NSWritingDirectionLeftToRight|NSWritingDirectionOverride, RLO: NSWritingDirectionRightToLeft|NSWritingDirectionOverride,
NSString * const NSVerticalGlyphFormAttributeName; // An NSNumber containing an integer value. 0 means horizontal text. 1 indicates vertical text. If not specified, it could follow higher-level vertical orientation settings. Currently on iOS, it's always horizontal. The behavior for any other value is undefined.
/************************ Attribute values ************************/
// This defines currently supported values for NSUnderlineStyleAttributeName and NSStrikethroughStyleAttributeName. NSUnderlineStyle*, NSUnderlinePattern*, and NSUnderlineByWord are or'ed together to produce an underline style.
typedef NS_ENUM(NSInteger, NSUnderlineStyle) {
NSUnderlineStyleNone = 0x00,
NSUnderlineStyleSingle = 0x01,
NSUnderlineStyleThick NS_ENUM_AVAILABLE(10_0, 7_0) = 0x02,
NSUnderlineStyleDouble NS_ENUM_AVAILABLE(10_0, 7_0) = 0x09,
NSUnderlinePatternSolid NS_ENUM_AVAILABLE(10_0, 7_0) = 0x0000,
NSUnderlinePatternDot NS_ENUM_AVAILABLE(10_0, 7_0) = 0x0100,
NSUnderlinePatternDash NS_ENUM_AVAILABLE(10_0, 7_0) = 0x0200,
NSUnderlinePatternDashDot NS_ENUM_AVAILABLE(10_0, 7_0) = 0x0300,
NSUnderlinePatternDashDotDot NS_ENUM_AVAILABLE(10_0, 7_0) = 0x0400,
NSUnderlineByWord NS_ENUM_AVAILABLE(10_0, 7_0) = 0x8000
} NS_ENUM_AVAILABLE(10_0, 6_0);
// NSWritingDirectionFormatType values used by NSWritingDirectionAttributeName. It is or'ed with either NSWritingDirectionLeftToRight or NSWritingDirectionRightToLeft. Can specify the formatting controls defined by Unicode Bidirectional Algorithm.
typedef NS_ENUM(NSInteger, NSWritingDirectionFormatType) {
NSWritingDirectionEmbedding = (0 << 1),
NSWritingDirectionOverride = (1 << 1)
} NS_ENUM_AVAILABLE(10_11, 9_0);
// NSTextEffectAttributeName values
NSString *const NSTextEffectLetterpressStyle ;
那些年,总也记不住的AttributeName
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 近日,由张介公博士主讲、喜马拉雅电台协助发行,全国各地的学子纷纷号召支持下,集科学教育记忆题材于一体的大型史诗教育...
- 【蝴蝶效应】 蝴蝶效应:上个世纪70年代,美国一个名叫洛伦兹的气象学家在解释空气系统理论时说,亚马逊雨林一只蝴蝶...