ios 富文本 加颜色 删除线

 UILabel *valueL = [JAppViewTools getLabel:CGRectMake(JFWidth(15), CGRectGetMaxY(proName.frame)+JFWidth(12), KSCreenWidth-JFWidth(30), JFWidth(14)) :JTextFCMake(JFFont(15), rgb(28, 218, 159))];
        valueL.text = [NSString stringWithFormat:@"%@ 金币    ¥%@",proModel.integration,proModel.price];
        
        
        NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc]initWithString:valueL.text];
        NSRange range1 = {valueL.text.length-proModel.price.length-1,proModel.price.length+1};

        //字体颜色
        [attributeStr addAttribute:NSForegroundColorAttributeName value:RGBlightGrayColor range:range1];
//删除线 [attributeStr addAttribute:NSStrikethroughStyleAttributeName value: @(NSUnderlineStyleSingle) range:range1]; valueL.attributedText = attributeStr;

猜你喜欢

转载自www.cnblogs.com/lishanshan/p/9224429.html