Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to underline label text of UIButton?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 4.86k
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: