swift UIButton中文本添加下划线的方法

var attributedString = NSMutableAttributedString(string:"点击预览")

var range = NSRange()

range.location=0

range.length=attributedString.length

attributedString.addAttributes(attrs, range: range)

// attributedString.appendAttributedString(buttonTitleStr)

rightBtn.setAttributedTitle(attributedString, forState: .Normal)

推荐阅读更多精彩内容