NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle],NSStrikethroughColorAttributeName:[UIColor orangeColor]};
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:@"原¥1000" attributes:attribtDic];
self.myLabel.attributedText = attribtStr;
去掉字符串中的‘原’,就能显示了
如果有中文文子怎么呢?
//看有哪里不一样
NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle],NSBaselineOffsetAttributeName : @(NSUnderlineStyleSingle),NSStrikethroughColorAttributeName:[UIColor orangeColor]};
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:@"原来如此¥1000" attributes:attribtDic];
self.myLabel.attributedText = attribtStr;
参考:http://blog.csdn.net/ymh1989qwe/article/details/70954275?utm_source=itdadao&utm_medium=referral