美文网首页
Swift 中划线

Swift 中划线

作者: 路有点颠簸 | 来源:发表于2022-04-14 14: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))"
    

    相关文章

      网友评论

          本文标题:Swift 中划线

          本文链接:https://www.haomeiwen.com/subject/hkmtertx.html