版权声明:本文为博主原创文章,未经博主允许不得转载。深圳夸克时代在线技术有限公司 官网:http://www.kksdapp.com https://blog.csdn.net/wahaha13168/article/details/82903891
extension UILabel {
func underline() {
if let textString = self.text {
let attributedString = NSMutableAttributedString(string: textString)
attributedString.addAttribute(.underlineStyle, value: NSUnderlineStyle.styleSingle.rawValue, range: NSRange(location: 0, length: attributedString.length))
attributedText = attributedString
}
}
}