iOS 同一段文字显示不同颜色

iOS开发-同一段文字显示不同颜色

http://blog.csdn.net/codingfire/article/details/50395838

NSString *testStr = @"当前可提现金额3000.00元";

NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:testStr];

[str addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0.27f green:0.61f blue:1.00f alpha:1.00f] range:NSMakeRange(7,testStr.length - 8)]; [str addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:20] range:NSMakeRange(7,testStr.length - 8)];

tixianLabel.attributedText = str;

原文地址:https://www.cnblogs.com/zyingn/p/iOS.html