Adding a screenshot for @Haider's answer.
Note: Only the text you highlight gets underlined, so you can underline just a specific range if you want.
I ended up underlining it in code anyway, just because I couldn't get Bold to work in conjunction with Underline for some reason. Could have been because of the font I was using, who knows.
@IBOutlet weak var underlineButton: UIButton! {
didSet {
let attrs = [
NSFontAttributeName : UIFont(name: "MyCustomFont-Bold", size: 19.0)!,
NSUnderlineStyleAttributeName: NSUnderlineStyle.StyleSingle.rawValue,
NSForegroundColorAttributeName : UIColor.orangeColor()
]
let attrString = NSMutableAttributedString(string: "Button text", attributes:attrs)
underlineButton.setAttributedTitle(attrString, forState: .Normal)
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…