Open ChrisRockC opened 7 years ago
NSString str = [NSString stringWithFormat:@"¥%@",commentModel.goodsPrice]; NSMutableAttributedString attrString = [[NSMutableAttributedString alloc] initWithString:str]; UIFont font = [UIFont systemFontOfSize:12]; [attrString addAttribute:NSFontAttributeName value:font range:NSMakeRange(1,commentModel.goodsPrice.length-1)]; UIFont font1 = [UIFont systemFontOfSize:18]; [attrString addAttribute:NSFontAttributeName value:font1 range:NSMakeRange(0,1)]; [self.priceLabel setAttributedText:attrString];
NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:str]; [text addAttribute:NSForegroundColorAttributeName value:kThemeGreen range:NSMakeRange(0, model.commentUserName.length)]; [text addAttribute:NSForegroundColorAttributeName value:kThemeGreen range:NSMakeRange(model.commentUserName.length + 2, model.commentByUserName.length)]; self.contentLabel.attributedText = text;