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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:59:49+00:00 2026-05-23T03:59:49+00:00

I’m having some trouble here. I’ve got a tableview, with 7 cells, all of

  • 0

I’m having some trouble here.

I’ve got a tableview, with 7 cells, all of them are made using .xib-files. Some of them contain labels, two contain a textview.

The current situation is that all the labels are shown correctly. The height of the cells are the same as the .xib-file states.

The problem is, the textviews are acting up strange. It might have to do something with the fact that I want them to be dynamic. Sometimes, it gives a long story in that textview. Sometimes, only one word. Therefore, the textview should be dynamic, and so should the cell’s height be.

The code looks like this:

DetLocDescrCell *locDCel = (DetLocDescrCell *)[tabelView dequeueReusableCellWithIdentifier:nil];
if (locDCel == nil) {
    [[NSBundle mainBundle] loadNibNamed:@"DetLocDescrCell" owner:self options:nil];
    locDCel = detLocDescrCell;
}
[locDCel.locDescrLabel setText:[geselecteerdItem objectForKey:@"LocationDescription"]];
CGRect descrFrame;
descrFrame = locDCel.locDescrLabel.frame;
descrFrame.size.height = [locDCel.locDescrLabel contentSize].height;
locDCel.locDescrLabel.frame = descrFrame;
descrFrame.size.height = descrFrame.size.height + 10;
locDCel.frame = descrFrame;
[listCells addObject:locDCel];

This code creates a custom cell from the class DetLocDescrCell, loads the data, check whenever the height should be adapted or not, adapts the height, then adds the cell to the list of cells. The list of cells is used again in cellForRowAtIndexPath and heightForRowAtIndexPath. But, the height isn’t adapted, and the textviews aren’t getting the correct text. Does anyone have any idea?

  • 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-23T03:59:50+00:00Added an answer on May 23, 2026 at 3:59 am

    i m not sure whether this is the right way , but i done this way,

    The situation is custom cell height & heightforrowatindex cell’s height should be same so i tried

    calculate the height of textview content in heightforrowatindexpath

    if(indexpath.row == 3) // containing textview 
    {
       CGSize textSize = [txtviewstring sizeWithFont:[UIFont systemFontOfSize:14] constrainedToSize:CGSizeMake(190, MAXFLOAT) lineBreakMode:UILineBreakModeWordWrap]; 
    }
    

    then in your cellforrowatindexpath – calculate the same height & initalize height to custom cell textview’s height cell.txtView.frame = CGRectMake (10,10,190,txtsize.height).

    then both u r txtview height & cell height will be equal

    Hope this idea helps!

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

Sidebar

Related Questions

I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

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.