iOS属性文字NSAttributedString

它本身是一个Foundation框架的类,

但如果要使用它主要用到了UIKit框架中的NSAttributedString中的一些常量字符串

------------------------------------------------------------------------------------------------------------

NSFontAttributeName:字体,是一个UIFont对象

NSParagraphStyleAttributeName:段落,是一个NSParagraphStyle对象

NSForegroundColorAttributeName:字体颜色,UIColor

NSBackgroundColorAttributeName:字体背景颜色,UIColor

NSLigatureAttributeName:连字符,NSNumber(整数),0没有,1默认

NSKernAttributeName:字间距,NSNumber(整数),默认0

NSStrikethroughStyleAttributeName:删除线,NSUnderlineStyle

NSUnderlineStyleAttributeName:下划线,NSUnderlineStyle

NSStrokeColorAttributeName:边框颜色,UIColor

NSStrokeWidthAttributeName:边框宽度,NSNumber(整数)

NSShadowAttributeName:阴影,NSShadow

NSVerticalGlyphFormAttributeName,横竖排版,NSNumber(整数),0横,1竖

------------------------------------------------------------------------------------------------------------

NSTextEffectAttributeName:设置文本特殊效果,取值为 NSString 对象,目前只有图版印刷效果可用

NSAttachmentAttributeName:设置文本附件,取值为NSTextAttachment对象,常用于文字图片混排

NSLinkAttributeName: 设置链接属性,点击后调用浏览器打开指定URL地址

NSBaselineOffsetAttributeName:设置基线偏移值,取值为 NSNumber (float),正值上偏,负值下偏

NSUnderlineColorAttributeName:设置下划线颜色

NSStrikethroughColorAttributeName:设置删除线颜色

NSObliquenessAttributeName:设置字形倾斜度,取值为 NSNumber (float),正值右倾,负值左倾

NSExpansionAttributeName: 设置文本横向拉伸属性,取值为 NSNumber (float),正值横向拉伸文本,负值横向压缩文本

NSWritingDirectionAttributeName:设置文字书写方向,从左向右书写或者从右向左书写

NSAttributedString的用法很简单,查看API就行了~~~~~~~~~~~~~~~~~~

posted @ 2016-04-13 13:56  幻想无极  阅读(1083)  评论(0编辑  收藏  举报