use NSAttributedString to underline the string itself
let btShop: UIButton = UIButton()
btShop.frame = CGRect(x: 40, y: 240, width: 320, height: 50)
let attributedString: NSAttributedString = NSAttributedString(string: NSLocalizedString("Buy", comment: ""), attributes:[
NSAttributedString.Key.font : UIFont.systemFont(ofSize: 16.0),
NSAttributedString.Key.foregroundColor : UIColor.gray,
NSAttributedString.Key.underlineStyle:1.0
])
btShop.setAttributedTitle(attributedString, for: .normal)
self.view.addSubview(btShop)
반응형
'iPhone' 카테고리의 다른 글
AWS Simple Notification Service p12 (0) | 2020.06.10 |
---|---|
Safe area / layout by code for iPhone X, XS, XR, XS Max (0) | 2020.06.10 |
rbenv install stuck at installing openssl (0) | 2020.06.09 |
iOS10 firebase crashlytics showing NSInternalInconsistencyException (0) | 2020.06.09 |
AWS SNS iOS push certificate (0) | 2016.07.28 |