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;
iOS Android Appcan WeChat
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步