iOS 为label加删除线

 

NSString *oldPrice = [NSString stringWithFormat:@"原价 %@",_item.previousPrice.stringValue];
    NSMutableAttributedString *attr = [[NSMutableAttributedString alloc]initWithString:oldPrice];
    [attr addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, oldPrice.length)];
    [_previousPriceLabel setAttributedText:attr];

 

posted @ 2016-03-27 23:57  Ficow  阅读(285)  评论(0编辑  收藏  举报