iOS 改变字符串其中一段字体和颜色

NSMutableAttributedString *textColor = [[NSMutableAttributedString alloc]initWithString:_bookPrice.text];
    NSRange rangel = [[textColor string] rangeOfString:[_bookPrice.text substringFromIndex:6]];
    [textColor addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:rangel];
    [textColor addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:17] range:rangel];

 [_lable setAttributedText:textColor];

你可能感兴趣的:(iOS开发,移动端+大前端+后台学习整合)