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

The Archive Base Latest Questions

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

I’m working on the project. Currently I’m facing a problem, I have 3 UITableView’s

  • 0

I’m working on the project. Currently I’m facing a problem, I have 3 UITableView’s in one ViewController. It looks something like this:

enter image description here

Now, The first TableView(top one), has just one row, that has a size of 55 pixels and it don;t have to be resizable. Next, second one is the TableView, again with one row, but this row must to resize depends on the content of it. Right now this TableView displaying this row:

enter image description here

This row must to resize depends on how long the text in it. What I did to calculate the size is:

if(tableView == self.usersPostOnTheWallTableView) {
    NSDictionary *propertyItems = [self.repliesItems objectAtIndex:indexPath.row];

    NSString *text = [self.postItems objectForKey:@"text"];

    NSLog(@"%@", text);

    CGSize constraintSize = CGSizeMake(280, MAXFLOAT);

    CGSize sizeText = [text sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap];

    self.height = MAX(sizeText.height, 44.0f);

    self.photosArray = [propertyItems objectForKey:@"attach_photos"];
    self.videosArray = [propertyItems objectForKey:@"attach_videos"];

    if((self.photosArray.count == 0) && (self.videosArray.count == 0)) {

        height += (CELL_CONTENT_MARGIN * 2);

    } else if ((self.videosArray.count > 0) && (self.photosArray.count == 0)) {

        height += 90 + (CELL_CONTENT_MARGIN * 2);

    } else if((self.photosArray.count > 0) && (self.videosArray.count == 0)) {

        height += 85 + (CELL_CONTENT_MARGIN * 2);
    }

}

Now, if the text is quite small, it fits the row well, and the row is resizes. Such as this:

enter image description here

But, after the text comes bigger, this what happening:

enter image description here

enter image description here

Obviously I don’t need the scrolling right there, and I would disable it. But the thing here is that it takes the size of the text, and it resize the label, you can see how many space it make from the top and from the bottom of the label. But it don’t put actual text there. Another thing is that it didn’t resize the TableView it self, when I’m trying to resize it, I get the overlapping of the bottom table by the middle table.

Can anyone recommend any solution of this, or maybe another way of implementation?

Thanks in advance!

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

    U can do this is use tableviewDelegate method for setting cell height according your text like this for example:

    This method will be called for every cell to decide how much cell should have height

      - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
     {
        NSString *strDetails = [yourTextArray objectAtIndex:indexPath.row];
       //if(indexPath.row == 1)
       //{
         CGSize stringSize = [strDetails sizeWithFont:[UIFont fontWithName:@"Marker Felt" size:13] constrainedToSize:CGSizeMake(320, 9999) lineBreakMode:UILineBreakModeWordWrap]; // Provide text as well as font name in which your text will be displayed and constrainedToSize which defines width and height it should be maximum
         return stringSize.height+65; //Here 65 can be any value depending on Calculation  ImageView height + uppermost space + bottom space added
       //}
       //else 
       //{
       //  return 80 // anything u wishes
       //}
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
I have this code to decode numeric html entities to the UTF8 equivalent character.
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am currently running into a problem where an element is coming back from
I have two tables with like below codes: Table: Accounts id | username |

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.