iOS开发改变字符串中指定字符颜色,大小等等

    NSString *strJTGZ = [NSString stringWithFormat:@"交通管制%d处 ",[jtgz intValue]];
    NSMutableAttributedString *attributedStr = [[NSMutableAttributedString alloc]initWithString:strJTGZ];
    [attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(4,jtgz.lenght)];
    [mutableStr appendAttributedString:attributedStr];

 

posted @ 2016-08-26 09:53  J-Vijay  阅读(4150)  评论(0编辑  收藏  举报