1、添加中划线:
UILabel *oldPriceLabel = (UILabel *)[selfviewWithTag:70+i];
NSString *oldStr = [NSStringstringWithFormat:@"%ld元",oldPrice];
//中划线
NSDictionary *attribtDic =@{NSStrikethroughStyleAttributeName: [NSNumbernumberWithInteger:NSUnderlineStyleSingle]};
NSMutableAttributedString *attribtStr = [[NSMutableAttributedStringalloc]initWithString:oldStrattributes:attribtDic];
oldPriceLabel.attributedText = attribtStr;
2、添加下划线:
UILabel *oldPriceLabel = (UILabel *)[selfviewWithTag:70+i];
NSString *oldStr = [NSStringstringWithFormat:@"%ld元",oldPrice];
//下划线
NSDictionary *attribtDic =@{NSUnderlineStyleAttributeName: [NSNumbernumberWithInteger:NSUnderlineStyleSingle]};
NSMutableAttributedString *attribtStr = [[NSMutableAttributedStringalloc]initWithString:oldStrattributes:attribtDic];
oldPriceLabel.attributedText = attribtStr;