iOS/코드조각

[iOS, Swift] UILabel 밑줄긋기(Underline)

검은참깨두유vm 2022. 8. 20. 19:41
반응형

iOS 15.5, Xcode 13.31, Swift 5, UIKit 환경에서 진행했습니다.

 

let attributedString = NSMutableAttributedString.init(string: "Apply UnderLining")
attributedString.addAttribute(NSAttributedString.Key.underlineStyle, value: 1, range: NSRange.init(location: 0, length: attributedString.length))
label.attributedText = attributedString

 

반응형