设置字体大小
NSFontAttributeName:[UIFontboldSystemFontOfSize:20]
NSString*constNSFontAttributeName ;
设置文本段落排版格式,取值为NSParagraphStyle对象
NSString*constNSParagraphStyleAttributeName ;
设置字体颜色
NSForegroundColorAttributeName:[UIColoryellowColor]
NSForegroundColorAttributeName value: [UIColor blueColor] range: NSMakeRange(0, 4)]; //指定位置的颜色
NSString*constNSForegroundColorAttributeName ;
背景颜色
NSBackgroundColorAttributeName:[UIColorredColor]
NSString*constNSBackgroundColorAttributeName ;
设置连体属性,取值为NSNumber对象(整数),0表示没有连体字符,1表示使用默认的连体字符
NSString*constNSLigatureAttributeName ;
设定字符间距,取值为NSNumber对象(整数),正值间距加宽,负值间距变窄
NSString*constNSKernAttributeName ;
添加删除线
NSString*constNSStrikethroughStyleAttributeName ;
添加下划线
NSString*constNSUnderlineStyleAttributeName ;
设置文字描边颜色
NSString*constNSStrokeColorAttributeName ;
设置笔画宽度,取值为NSNumber对象(整数),负值填充效果,正值中空效果
NSString*constNSStrokeWidthAttributeName ;
设置阴影NSShadow
NSString*constNSShadowAttributeName ;
设置文本特殊效果,取值为NSString对象,目前只有图版印刷效果可用:
NSString*constNSTextEffectAttributeName ;
设置文本附件,取值为NSTextAttachment对象,常用于文字图片混排
NSString*constNSAttachmentAttributeName ;
设置链接属性,点击后调用浏览器打开指定URL地址
NSString*constNSLinkAttributeName ;
设置基线偏移值,取值为NSNumber(float),正值上偏,负值下偏
NSString*constNSBaselineOffsetAttributeName ;
设置下划线颜色,取值为UIColor对象,默认值为黑色
NSString*constNSUnderlineColorAttributeName ;
设置删除线颜色,取值为UIColor对象,默认值为黑色
NSString*constNSStrikethroughColorAttributeName ;
设置字形倾斜度,取值为NSNumber(float),正值右倾,负值左倾
NSString*constNSObliquenessAttributeName ;
设置文本横向拉伸属性,取值为NSNumber(float),正值横向拉伸文本,负值横向压缩文本
NSString*constNSExpansionAttributeName ;
设置文字书写方向,从左向右书写或者从右向左书写
NSString*constNSWritingDirectionAttributeName ;
设置文字排版方向,取值为NSNumber对象(整数),0表示横排文本,1表示竖排文本
NSString*constNSVerticalGlyphFormAttributeName ;
凹版印刷效果(NSTextEffectAttributeName的值)
NSString*constNSTextEffectLetterpressStyle ;
NSString*constNSPlainTextDocumentType ;
NSString*constNSRTFTextDocumentType ;
NSString*constNSRTFDTextDocumentType ;
NSString*constNSHTMLTextDocumentType ;
NSString*constNSTextLayoutSectionOrientation ;
NSString*constNSTextLayoutSectionRange ;
NSString*constNSDocumentTypeDocumentAttribute ;
NSString*constNSCharacterEncodingDocumentAttribute ;
NSString*constNSDefaultAttributesDocumentAttribute ;
NSString*constNSPaperSizeDocumentAttribute ;
NSString*constNSPaperMarginDocumentAttribute ;
NSString*constNSViewSizeDocumentAttribute ;
NSString*constNSViewZoomDocumentAttribute ;
NSString*constNSViewModeDocumentAttribute ;
NSString*constNSReadOnlyDocumentAttribute ;
NSString*constNSBackgroundColorDocumentAttribute ;
NSString*constNSHyphenationFactorDocumentAttribute ;
NSString*constNSDefaultTabIntervalDocumentAttribute ;
NSString*constNSTextLayoutSectionsAttribute ;
typedefNS_ENUM(NSInteger, NSUnderlineStyle) {
NSUnderlineStyleNone=0x00,
NSUnderlineStyleSingle=0x01,
NSUnderlineStyleThick=0x02,
NSUnderlineStyleDouble=0x09,
NSUnderlinePatternSolid=0x0000,
NSUnderlinePatternDot=0x0100,
NSUnderlinePatternDash=0x0200,
NSUnderlinePatternDashDot=0x0300,
NSUnderlinePatternDashDotDot=0x0400,
NSUnderlineByWord=0x8000
}
typedefNS_ENUM(NSInteger, NSTextWritingDirection) {
NSTextWritingDirectionEmbedding= (0<<1),
NSTextWritingDirectionOverride= (1<<1)
} ;
@interfaceNSMutableAttributedString (NSMutableAttributedStringKitAdditions)
- (void)fixAttributesInRange:(NSRange)range ;
@end
@interfaceNSAttributedString (NSAttributedStringDocumentFormats)
- (instancetype)initWithFileURL:(NSURL*)url options:(NSDictionary*)options documentAttributes:(NSDictionary**)dict error:(NSError**)error ;
- (instancetype)initWithData:(NSData*)data options:(NSDictionary*)options documentAttributes:(NSDictionary**)dict error:(NSError**)error ;
- (NSData*)dataFromRange:(NSRange)range documentAttributes:(NSDictionary*)dict error:(NSError**)error ;
- (NSFileWrapper*)fileWrapperFromRange:(NSRange)range documentAttributes:(NSDictionary*)dict error:(NSError**)error ;
@end
@interfaceNSMutableAttributedString (NSMutableAttributedStringDocumentFormats)
- (BOOL)readFromFileURL:(NSURL*)url options:(NSDictionary*)opts documentAttributes:(NSDictionary**)dict error:(NSError**)error ;
- (BOOL)readFromData:(NSData*)data options:(NSDictionary*)opts documentAttributes:(NSDictionary**)dict error:(NSError**)error ;
@end
网友评论