Swift 中划线

2022-04-14  本文已影响0人  路有点颠簸
image.png

方式一

let priceString = NSMutableAttributedString.init(string: "99元")
priceString.addAttribute(.strikethroughStyle, value: NSUnderlineStyle.single.rawValue, range: NSRange(location: 0, length: 2))
amountLab.attributedText = priceString

方式二

使用三方库ASAttributedString

amountLab.attributed.text = "\("99元", .strikethrough(NSUnderlineStyle.single, color: .red))"
上一篇下一篇

猜你喜欢

热点阅读