label富文本添加删除线

NSString *oldPrice = self.oldMoney.text;
    NSUInteger length = [oldPrice length];
    NSMutableAttributedString *attritu = [[NSMutableAttributedString alloc]initWithString:self.oldMoney.text];
    [attritu addAttributes:@{
                             NSStrikethroughStyleAttributeName:@(NSUnderlineStyleThick),
                             NSForegroundColorAttributeName:
                                 [UIColor lightGrayColor],
                             NSBaselineOffsetAttributeName:
                                 @(0),
                             NSFontAttributeName: [UIFont systemFontOfSize:14]
                             } range:NSMakeRange(0, length)];
    [self.oldMoney setAttributedText:attritu];

你可能感兴趣的:(label富文本添加删除线)