//将一个字符串分两种颜色
-(NSMutableAttributedString*)changeStrColor:(NSString *)string{
NSMutableAttributedString *str = [[NSMutableAttributedStringalloc]initWithString:string];
[str addAttribute:NSForegroundColorAttributeNamevalue:[UIColorblackColor]range:NSMakeRange(0,3)];
[str addAttribute:NSForegroundColorAttributeNamevalue:[UIColorredColor]range:NSMakeRange(4,string.length -4)];
return str;
}
将一个字符串分多种颜色显示
最新推荐文章于 2024-07-02 04:59:46 发布