Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何编写如下字符串:
H̶̶o̶̶w̶̶t̶o̶̶w̶r̶̶i̶t̶̶e̶̶t̶̶h̶i̶̶s̶̶t̶̶e̶̶x̶̶t̶
在我的应用程序中,我需要显示已被新价格替换的产品的过去价格。像这样:
$̶8̶̶0̶̶0̶ -> $600
要获得此结果,您应该使用 NSAttributedString 并设置属性名称 NSStrikethroughStyleAttributeName。用作此键对象的数字定义了文本上线条的样式。
self.myLabel.attributedText = [[NSAttributedString alloc] initWithString:@"800" attributes:@{NSStrikethroughStyleAttributeName: @1}];
干杯