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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:55:55+00:00 2026-05-29T10:55:55+00:00

I´m using custom cells in a TableView. The cell height is calculated based on

  • 0

I´m using custom cells in a TableView.

The cell height is calculated based on an NSString that is loaded in a UILabel of the cell.
The size is calculated using this function

(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;
{
NSString *text = [self getTableViewRow:tableView index:indexPath];

CGSize constraint = CGSizeMake(CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN * 2), 20000.0f);

CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:FONT_SIZE] constrainedToSize:constraint lineBreakMode:UILineBreakModeWordWrap];

CGFloat height = MAX(size.height, 44.0f);

return height + (CELL_CONTENT_MARGIN * 2) + 60;

}

The size is calculated correctly but when the cell is loaded to the uiTableView, the row has the correct height but the cell does not have.

This is where i create my cell

//Com Custom Cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"CustomCellIdentifier";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

if (cell == nil) 
{
    NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCellApresentacao" owner:self options:nil];

    if ([nib count] > 0 )
        cell = self.tvCell;    
    else
        NSLog(@"Falhou a carregar o xib");
}    

NSInteger row = [indexPath row];

if(self.myTableView1 == tableView)
    labelDescricaoApresentacao.text = [listData1 objectAtIndex:row];
else if (self.myTableView2 == tableView) 
    labelDescricaoApresentacao.text = [listData2 objectAtIndex:row];
else
    labelDescricaoApresentacao.text = [listData3 objectAtIndex:row];  

return cell;
}

i tried to change the cell height in this method using

cell.frame.size.height

but it still didn´t loaded the correct heigth.

Do i have to do anything in the xib of the customCell?
How should i update the cell heigth to the same size has the row?

  • 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-29T10:55:56+00:00Added an answer on May 29, 2026 at 10:55 am

    Where did you set the cell.frame.size.height? I would recommend trying to put it here:

    - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
        cell.frame = CGRectMake(0,0,320.0f,30.0f);
    }
    

    This method gets called right before the cell is displayed and is a good place to make any visual changes to the cell.

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

Sidebar

Related Questions

Hi I am using a custom tableview cell that has an up/down button for
I'm using a custom tableview cell (like Tweetie's fast scrolling) i've added a gradient
I am using custom UITableview concept to show data in cell of tableview. My
I have a UITableView that uses custom cells, loaded from nibs, and hooked up
I make one tableview in which I add button type cell using custom cell.
I am using custom cell and adding tableview programmetically. I am trying to implement
I have a tableview which contains custom cells where each cell has some PDF
I'm using custom cells in my table view. I have the height of the
I have a table that displays cell using UITableViewCellStyleSubtitle: ============================================================= Title:This is the title
I am using apple's custom table view cell code and modifying the drawRect code

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.