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 6867467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:18:48+00:00 2026-05-27T03:18:48+00:00

I have UITableView with custom cells, which contain uilabels. I am using it to

  • 0

I have UITableView with custom cells, which contain uilabels.
I am using it to show comments and it must have flexible height.
How can I do it?
I have code, which counting number of rows with help of uilabel.text length, but it is wrong way. Have you any ideas?

  • 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-27T03:18:49+00:00Added an answer on May 27, 2026 at 3:18 am

    Use UILabel with numberOfLines set to zero.

    Then, for making sure that your label actually fits into the cell, get the dimensions from the NSString UIKit extension like this;

    CGFloat cellWidth = 320.0f; //example width....
    labelSize = [label.text sizeWithFont:label.font constrainedToSize:CGSizeMake(cellWidth, FLT_MAX)];
    

    From the NSString reference;
    sizeWithFont:constrainedToSize:

    Returns the size of the string if it were rendered and constrained to
    the specified size.

    - (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size

    Parameters font The font to use for computing the string size. size
    The maximum acceptable size for the string. This value is used to
    calculate where line breaks and wrapping would occur. Return Value The
    width and height of the resulting string’s bounding box.

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

Sidebar

Related Questions

I have a UITableView whose cells contain custom ImageViews that asynchronously load the images
I have a UITableView which loads data from XML using the below code. It
I have a UITableView with custom UITableViewCells in it. These cells can be opened
I have a UITableView with two custom cells and each of them has a
I have a UITableView of custom UITableViewCells which looks like this: [ CELL 0
I have a custom UITableView cell which has a button and a label. I
I have a UITableView on a view. This UITableView has cells which are made
I have a uitableview with 2 cells (custom tableviewcells) and a button for login.
I have a ViewController that contains a UITableView in which the cells are created
I have a UITableView with custom Cells. These cells are containing each an OpenGL

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.