Underlining title text of UIButton can be done with attributed string using following code (In this case yourTitleLabelText is title text for button and yourButtonObject is button object):
NSMutableAttributedString *titleString = [[NSMutableAttributedString alloc] initWithString:yourTitleLabelText];
// making text property to underline text-
[titleString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleSingle] range:NSMakeRange(0, [titleString length])];
// using text on button
[yourButtonObject setAttributedTitle: titleString forState:UIControlStateNormal];
0 Comment(s)