Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8747735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:24:22+00:00 2026-06-13T12:24:22+00:00

How can I make an underlined text in UILabel ? I had tried by

  • 0

How can I make an underlined text in UILabel?

I had tried by making a UILabel with height 0.5f and place it under the text. This line label is not visible when I am running my app in iPhone 4.3 and iPhone 4.3 simulator, but it is visible in iPhone 5.0 simulator onwards. Why?

How can I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:24:23+00:00Added an answer on June 13, 2026 at 12:24 pm

    Objective-C

    iOS 6.0 > version

    UILabel supports NSAttributedString

    NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:@"Hello Good Morning"];
    [attributeString addAttribute:NSUnderlineStyleAttributeName
                            value:[NSNumber numberWithInt:1]
                            range:(NSRange){0,[attributeString length]}];
    

    Swift

    let attributeString: NSMutableAttributedString =  NSMutableAttributedString(string: "Hello Good Morning")
    attributeString.addAttribute(NSUnderlineStyleAttributeName, value: 1, range: NSMakeRange(0, attributeString.length))
    

    Definition :

    - (void)addAttribute:(NSString *)name value:(id)value range:(NSRange)aRange
    

    Parameters List:

    name : A string specifying the attribute name. Attribute keys can be supplied by another framework or can be custom ones you define. For information about where to find the system-supplied attribute keys, see the overview section in NSAttributedString Class Reference.

    value : The attribute value associated with name.

    aRange : The range of characters to which the specified attribute/value pair applies.

    Now use like this:

    yourLabel.attributedText = [attributeString copy];
    

    iOS 5.1.1 < version

    You needs 3 party attributed Label to display attributed text:

    1) Refer TTTAttributedLabel link. Its best third party attributed Label to display attributed text.

    2) refer OHAttributedLabel for third party attributed Label

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can I specify how text is underlined? For example can I make it underlined
I can make a log in for easily, so that's not the problem. What
I can make batch or vbs file on windows and run. this can automate
Can someone tell me how I can make a table be 100% height in
I tried many css from other places and stackoverflow, but somehow I can not
I want to make a simple thinge. Just a text with underline line like
I have a checkbox which can make a post password protected- <p><strong><label for=password>Password protect?</label></strong>
How can I make the background of .post_headline_signup the same height as the background
I can make my program write a .dat file with an array of Node
How can make a link within a facebox window that redirects it to another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.