中划线:
UILabel * strikeLabel = [[UILabel alloc] initWithFrame:(CGRectMake(10, 10, 50, 30))];
NSString *textStr = @"10000¥";
//中划线
NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc] initWithString:textStr attributes:attribtDic];
// 赋值
strikeLabel.attributedText = attribtStr;
[self.view addSubview:strikeLabel];
下划线:
UILabel *underlineLabel = [[UILabel alloc] initWithFrame:(CGRectMake(10, 100, 50, 30))];
// 下划线
NSDictionary *attribtDic2 = @{NSUnderlineStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
NSMutableAttributedString *attribtStr2 = [[NSMutableAttributedString alloc]initWithString:textStr attributes:attribtDic2];
//赋值
underlineLabel.attributedText = attribtStr2;
[self.view addSubview:underlineLabel];