iOS Developer

字符串中加深个别字体颜色和字体大小

2017-01-06  本文已影响13人  Mrxiaowang

NSMutableAttributedString *textColor = [[NSMutableAttributedString alloc]initWithString:_bookPrice.text];

NSRange rangel = [[textColor string] rangeOfString:[_bookPrice.text substringFromIndex:6]];

[textColor addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:rangel];

[textColor addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:17] range:rangel];

[_lable setAttributedText:textColor];

上一篇 下一篇

猜你喜欢

热点阅读