美文网首页
UILabel 指定字段改变颜色

UILabel 指定字段改变颜色

作者: 隔墙送来秋千影 | 来源:发表于2021-08-27 14:54 被阅读0次
    NSString *priceText = [NSString stringWithFormat:@"售价:%@元", self.priceArr[sender.tag]];
    NSMutableAttributedString *priceLabStr = [[NSMutableAttributedString alloc]initWithString:priceText];
    [priceLabStr setAttributes:@{NSForegroundColorAttributeName:COLOR_MAIN, NSFontAttributeName:Font_Medium(18)} range:NSMakeRange(3, priceText.length - 4)];
    self.priceLab.attributedText = priceLabStr;

相关文章

网友评论

      本文标题:UILabel 指定字段改变颜色

      本文链接:https://www.haomeiwen.com/subject/kwymiltx.html