[iOS] 为文本加上横线方法

 _oldPriceLabel.text = @"3500";
_oldPriceLabel.textColor = [UIColor lightGrayColor];
NSMutableAttributedString *newPrice = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"¥%@",_oldPriceLabel.text]];
[newPrice addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, newPrice.length)];
 _oldPriceLabel.attributedText = newPrice;

 

posted @ 2016-11-01 19:21  death3721  阅读(255)  评论(0编辑  收藏  举报