美文网首页
iOS text显示不同颜色

iOS text显示不同颜色

作者: BetterComingDay | 来源:发表于2017-02-09 16:33 被阅读6次

拷贝代码备用

NSString *noLabelString = [NSString stringWithFormat:@"[预售]订单号:%@",_order.orderId];
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:noLabelString];
NSDictionary *attributesDict = @{NSForegroundColorAttributeName:[VCColor darkRedColor]};
[attributedString addAttributes:attributesDict range:NSMakeRange(0, 4)];
_orderNoLabel.attributedText = attributedString;

相关文章

网友评论

      本文标题:iOS text显示不同颜色

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