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

  • Home
  • SEARCH
  • 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 6823037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:44:05+00:00 2026-05-26T21:44:05+00:00

I need to do some special alignment with a UILabel. I want it to

  • 0

I need to do some special alignment with a UILabel.

I want it to have 1 to 3 lines, whatever content it has.

Currently I’m doing it something like this:

label.font = [UIFont fontWithName:@"HelveticaNeue-Bold" size:14.0f];
label.backgroundColor = [UIColor clearColor];
label.numberOfLines = 0;
label.lineBreakMode = UILineBreakModeWordWrap;

label.frame = CGRectMake(114.0f, 88.0f, 187.0f, 0.0f);
[label sizeToFit];

which works great if the text is not too long. if the string is something like @"Hello World" the UILabel is only 14 points high, if it is some way longer it expands.

Now I want that the text should add it’s default ... triple dots if the text gets too long for three lines, but with the setting on top it expands to the fourth line.

How do I achieve 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-05-26T21:44:05+00:00Added an answer on May 26, 2026 at 9:44 pm
    label.numberOfLines = 3;
    CGSize size = [label.text sizeWithFont:label.font
                         constrainedToSize:CGSizeMake(SOME_WIDTH,
                                                      3 * label.font.lineHeight)
                             lineBreakMode:UILineBreakModeWordWrap];
    label.bounds = CGRectMake(0, 0,
                              size.width,
                              size.height);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need some help about with Memcache. I have created a class and want to
I have some special cookies. I need those cookie was set by server code
I have a TableLayout inside a ScrollView, because of some special needs, I need
I have some special tags on my blogsite which need to be as simple
for some special needs of my software development work i need to have a
Say I need some very special multiplication operator. It may be implemented in following
I need to do some special operation for the last element in a list.
I need to pass '+' via the QueryString . some special character can be
Need some help, please. I have a line of horizontal thumbnails loaded as ONE
Need some help to solve this. I have a gridview and inside the gridview

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.