1

如何编写如下字符串:

H̶̶o̶̶w̶̶t̶o̶̶w̶r̶̶i̶t̶̶e̶̶t̶̶h̶i̶̶s̶̶t̶̶e̶̶x̶̶t̶

在我的应用程序中,我需要显示已被新价格替换的产品的过去价格。像这样:

$̶8̶̶0̶̶0̶ -> $600

4

1 回答 1

4

要获得此结果,您应该使用 NSAttributedString 并设置属性名称 NSStrikethroughStyleAttributeName。用作此键对象的数字定义了文本上线条的样式。

self.myLabel.attributedText = [[NSAttributedString alloc] initWithString:@"800" attributes:@{NSStrikethroughStyleAttributeName: @1}];

干杯

于 2014-04-19T16:50:31.000 回答