Friday 28 July 2017

How to underline a UILabel and UIButton programatically in swift 3



For Label:labelname.attributedText = NSAttributedString(string: "text", attributes:            [NSUnderlineStyleAttributeName: NSUnderlineStyle.styleSingle.rawValue])

o/p: text




For Button: let linkbuttonAttributes : [String: Any] = [NSUnderlineStyleAttributeName : NSUnderlineStyle.styleSingle.rawValue] let attributeString = NSMutableAttributedString(string: "Terms and Conditions",                                                    attributes: linkbuttonAttributes) termsofServices.setAttributedTitle(attributeString, for: .normal)

o/p: Terms and Conditions

No comments:

Post a Comment

Remove bottom line in navigation bar

navigationController ?. navigationBar . setBackgroundImage ( UIImage (), for: . any , barMetrics: . default )          navigat...