美文网首页
attributedText 简单属性使用

attributedText 简单属性使用

作者: 小猪圣骑士 | 来源:发表于2015-12-30 13:28 被阅读86次

NSBackgroundColorAttributeName

区域内字体的背景颜色

( 以下的 str 都是 NSMutableAttributedString )

[str addAttribute:NSBackgroundColorAttributeName

value:[ UIColor blackColor ]

range:NSMakeRange(1,6)];

NSBaselineOffsetAttributeName

区域内字体的设置基线偏移值

[str addAttribute:NSBaselineOffsetAttributeName

value:@(2)

range:NSMakeRange(1,6)];

@( 2 ) 是调整位置 正值上偏,负值下偏

NSFontAttributeName

区域内字体的字体

[str addAttribute:NSFontAttributeName

value:[UIFont boldSystemFontOfSize:12]

range:NSMakeRange(1, 6)];

NSForegroundColorAttributeName

区域内字体的颜色

[str addAttribute:NSForegroundColorAttributeName

value:[UIColor blackColor]

range:NSMakeRange(1, 6)];

( 待续更新... )

相关文章

网友评论

      本文标题:attributedText 简单属性使用

      本文链接:https://www.haomeiwen.com/subject/zmyihttx.html