Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic textview in dynamic custom cells
    primarykey
    data
    text
    <p>I'm having some trouble here. </p> <p>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.</p> <p>The current situation is that all the labels are shown correctly. The height of the cells are the same as the .xib-file states. </p> <p>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. </p> <p>The code looks like this:</p> <pre><code>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]; </code></pre> <p>This code creates a custom cell from the class <code>DetLocDescrCell</code>, 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 <code>cellForRowAtIndexPath</code> and <code>heightForRowAtIndexPath</code>. But, the height isn't adapted, and the textviews aren't getting the correct text. Does anyone have any idea?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload