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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:08:51+00:00 2026-06-09T05:08:51+00:00

I am trying to make the cells inside my UITableView adapt to the length

  • 0

I am trying to make the cells inside my UITableView adapt to the length of the text in them. If the text is too long, the cell grow a bit taller to fit it.

I am trying something like this:

cell.textLabel.numberOfLines = 0;
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;

cell.textLabel.text = [[name stringByAppendingString:@": "] 
                               stringByAppendingString:comment];

But what happens is that the cell just tries to fit the text into same vertical amount of space, and does not get any taller.

Would anyone know what I am doing incorrectly here?

Thank you!

  • 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-09T05:08:53+00:00Added an answer on June 9, 2026 at 5:08 am

    You need to use the cell height delegate. Take a look here: dynamic UITableViewCell height .

    What you need to do is calculate the text height, and then set the cell’s height to that.
    Specifically this method:

    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
        NSString *yourText = [someArray objectAtIndex:indexPath.row];
        CGSize constraint = CGSizeMake(320 /*cell width*/, CGFLOAT_MAX);
        CGSize size = [yourText sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];
        CGFloat height = MIN(size.height, 44.0f);
    
        return height;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to add explanation between cells. I'm experimenting with sections, trying to make
I am trying to make a table cell that when tapped calls a phone
I am trying make long screen to vertical direction. So, I need a screen
I am trying to make a class so when I do the following inside
I'm trying to make tables inside tables in WORD. of course in finall program
I'm trying to make some components inside a JSrollPane unresizable, because content inside can
In my code i have a table with static cell inside storyboards. I'm trying
So I've got this control I'm trying to make. It's an in-place text editor
I'm trying to implement a custom UITableView cell as the prototype for a tableview.
i am trying to make tableview with custom cell . every cell have uiscrollview

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.