iOS中富文本NSMutableAttributedString的用法

NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]initWithString:@"我是富文本"];
//字体
[attrString addAttribute:NSFontAttributeName
value:[UIFont systemFontOfSize:12.0]
range:NSMakeRange(0, 2)];
//粗细 负为实体,正为中空
[attrString addAttribute:NSStrokeWidthAttributeName
value:@(-3)
range:NSMakeRange(0, attrString.length)];
//颜色
[attrString addAttribute:NSForegroundColorAttributeName
value:[UIColor redColor]
range:NSMakeRange(0, attrString.length)]; [labelInstance setAttributedText:attrString];

  参考:http://www.jianshu.com/p/6665c088bd01

上一篇:转:what is TWO_TASK


下一篇:【题解】晋升者计数 Promotion Counting [USACO 17 JAN] [P3605]