NSString 富文本 字符串中间一段变字体颜色

 NSMutableAttributedString *attributedStr = [[NSMutableAttributedStringalloc]initWithString:@"本人已充分了解本保险产品,并承诺投保信息的真实性,理解并同意《商户协议》《保险条约》的全部内容"];
    
    [attributedStr addAttribute:NSFontAttributeNamevalue:[UIFontsystemFontOfSize:13]range:NSMakeRange(0, attributedStr.length) ];
    [attributedStr addAttribute:NSForegroundColorAttributeNamevalue:[UIColorcolorWithHexString:@"#01A3FE"]range:NSMakeRange(30,12)];
    self.agreementL.attributedText = attributedStr;
    


参考链接
http://www.mamicode.com/info-detail-468586.html

http://blog.csdn.net/reylen/article/details/41208747



你可能感兴趣的:(iOS)