iOS中改变部分字体颜色
?NSString *secondStr = [NSString stringWithFormat:@"認(rèn)識(shí)的單詞共計(jì): %ld ",(long)_yesCount];
? ? NSMutableAttributedString *ssa = [[NSMutableAttributedString alloc] initWithString:secondStr];
? ? [ssa addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(8,2)];
? ? _secondLabel.attributedText = ssa;
?? ?
?? ?
? ? NSString *thirdStr = [NSString stringWithFormat:@"不認(rèn)識(shí)的單詞共計(jì): %ld ",(long)_noCount];
? ? NSMutableAttributedString *ssb = [[NSMutableAttributedString alloc] initWithString:thirdStr];
? ? [ssb addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(9,2)];
? ? _thirdLabel.attributedText = ssb;
轉(zhuǎn)載于:https://www.cnblogs.com/candyMan1001/p/6202504.html
《新程序員》:云原生和全面數(shù)字化實(shí)踐50位技術(shù)專家共同創(chuàng)作,文字、視頻、音頻交互閱讀總結(jié)
以上是生活随笔為你收集整理的iOS中改变部分字体颜色的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 《C++ Primer Plus(第六版
- 下一篇: Scrapy shell调试网页的信息