How to use NSUnderlineStyle.PatternDot

后端 未结 1 1508
我在风中等你
我在风中等你 2020-12-11 07:35

I am trying to use NSMutableAttributedString with dotted underline below is my code but none of the Patterns seem to work am I missing something ?

var str :          


        
相关标签:
1条回答
  • 2020-12-11 08:05

    You have to do it like this:

    Xcode 10 • Swift 4.2 or later

    yourLabel.attributedText = NSAttributedString(string: "Hello World !!!", attributes: [.underlineStyle: NSUnderlineStyle.patternDot.union(.single).rawValue])
    

    Note: for older Swift syntax check edit history

    0 讨论(0)
提交回复
热议问题