iOS NSAttributedString 富文本可添加属性

本文详细介绍了iOS和MacOS中的NSUnderlineStyle枚举常量,以及NSAttributedStringKey相关属性,如下划线样式、颜色、背景、链接等,展示了如何控制文本的呈现方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

NSUnderlineStyle
下划线样式和删除线样式属性键的常量。
typedef enum NSUnderlineStyle : NSInteger {
    ...
} NSUnderlineStyle;

常数
NSUnderlineStyleNone
不要划线。
NSUnderlineStyleSingle
画一条线。
NSUnderlineStyleThick
画一条粗线。
NSUnderlineStyleDouble
画一条双线。
NSUnderlineStylePatternSolid
画一条实线。
NSUnderlineStylePatternDot
画一条点线。
NSUnderlineStylePatternDash
画一条破折号线。
NSUnderlineStylePatternDashDot
画一条交替的破折号和点线。
NSUnderlineStylePatternDashDotDot
画一条由交替的破折号和两个点组成的线。
NSUnderlineStyleByWord
只在文字下方或通过文字画线,而不是空格。
荒废的
NSUnderlinePatternSolid
一条实线。
NSUnderlinePatternDot
一行点。
NSUnderlinePatternDash
一行破折号。
NSUnderlinePatternDashDot
一行交替的破折号和点。
NSUnderlinePatternDashDotDot
一行交替的破折号和两个点。
NSUnderlineByWord
仅在单词下方或通过单词的行,而不是空格。
另见
指定文本属性
NSAttributedStringKey
可应用于属性字符串中的文本的属性。
NSTextEffectStyle
文本效果属性键的常量。
NSSpellingState
拼写状态属性键的常量。
NSWritingDirectionFormatType
写入方向属性键的常量。
NSUnderlineStrikethroughMask
定义下划线掩码的常量。
NSPresentationIntent
文本块(如段落、列表、代码块和部分表格)的预期表示形式。
NSPresentationIntentKind
枚举文本块(如段落、列表和代码块)的预期显示样式。
NSInlinePresentationIntent
一种类型,用于定义字符运行的表示意图,用于强调、删除线和代码语音等特征。
NSPresentationIntentTableColumnAlignment
用于对齐表列内容的值枚举。

NSUnderline样式属性名称
文本的下划线样式。
const NSAttributedStringKey NSUnderlineStyleAttributeName;

Key值
NSAttachmentAttributeName
文本的附件。
NSBackgroundColorAttributeName
文本后面的背景颜色。
NSBaselineOffsetAttributeName
文本位置的垂直偏移量。
NSCursorAttributeName
游标对象。
NSExpansionAttributeName
文本的扩展系数。
荒废的
NSFontAttributeName
文本的字体。
NSForegroundColorAttributeName
文本的颜色。
NSGlyphInfoAttributeName
字形信息对象的名称。
NSKernAttributeName
文本的字距调整。
NSLigatureAttributeName
文本的连字。
NSLinkAttributeName
文本的链接。
NSMarkdownSourcePositionAttributeName
Markdown 源字符串中与某些属性化文本相对应的位置。
NSMarkedClauseSegmentAttributeName
标记子句段的索引。
NSObliquenessAttributeName
文本的倾斜度。
荒废的
NSParagraphStyleAttributeName
文本的段落样式。
NSShadowAttributeName
文本的阴影。
NSSpellingStateAttributeName
文本的拼写状态。
NSStrikethroughColorAttributeName
删除线的颜色。
NSStrikethroughStyleAttributeName
文本的删除线样式。
NSStrokeColorAttributeName
描边的颜色。
NSStrokeWidthAttributeName
描边的宽度。
NSSuperscriptAttributeName
文本的上标。
NSTextAlternativesAttributeName
文本的替代项。
NSTextEffectAttributeName
文本效果。
NSToolTipAttributeName
工具提示文本。
NSUnderlineColorAttributeName
下划线的颜色。
NSVerticalGlyphFormAttributeName
文本的垂直字形形式。
荒废的
NSWritingDirectionAttributeName
文本的写作方向。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值