zoukankan      html  css  js  c++  java
  • 改变字符串颜色从哪里开始截取改变颜色

      NSString * pricstr=@"价格:";

        _pricelable.text = [NSString stringWithFormat:@"%@%@",pricstr,drawmodel.shop_price];

        //改变字符串颜色

        NSMutableAttributedString *textColor = [[NSMutableAttributedString alloc]initWithString:_pricelable.text];

        NSRange rangel = [[textColor string] rangeOfString:[_pricelable.text substringFromIndex:3]];

        [textColor addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:rangel];

        [textColor addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:15] range:rangel];

        [_pricelable setAttributedText:textColor];

  • 相关阅读:
    Vijos1986
    vijos1790
    洛谷1005
    洛谷3381
    bzoj4034
    bzoj1564
    bzoj2648
    洛谷3348
    jzoi4964
    codevs3990
  • 原文地址:https://www.cnblogs.com/whx060900/p/7985447.html
Copyright © 2011-2022 走看看