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