I Want to doted underline on label in Swift
Asked
Active
Viewed 179 times
2 Answers
0
//you can add doted underline string like this in swift 5
let string = NSMutableAttributedString(string: "Hello string")
string.addAttributes([.underlineStyle : NSUnderlineStyle.single.union(.patternDot).rawValue],
range: NSRange(location: 0, length: string.length))
yourLableName.attributedText = string

ikbal
- 1,114
- 1
- 11
- 30
0
You can use NSAttributedString
for setting underline in swift 5.
let string = NSAttributedString(string: "Receiver", attributes: [.underlineStyle: NSUnderlineStyle.single.union(.patternDash).rawValue])
label.attributedText = string

Mahendra
- 8,448
- 3
- 33
- 56