title: How to change rowHeight of a TableViewCell depending on Stringlength
body: <p>I have a table with different entries, each with different length. The height of each row should fit, so it can show the whole string.</p>
  
  <p>I use the following code:</p>
  
  <pre><code>//... cellForRowAtIndexPath
  if (row == 0) {
  
      cell = [tableView dequeueReusableCellWithIdentifier:@"affCell"];
      //if (!cell) {
       cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"affCell"]autorelease];
       cell.accessoryType = UITableViewCellAccessoryNone;
       cell.selectionStyle = UITableViewCellSelectionStyleNone;
       cell.autoresizingMask = UIViewAutoresizingFlexibleHeight;
  
       affL = [[UILabel alloc] initWithFrame:CGRectZero];
       affL.textAlignment = UITextAlignmentLeft;
       affL.autoresizingMask = UIViewAutoresizingFlexibleHeight;
       [cell.contentView addSubview:affL];
      //}
      //declaration label
      affL.text = [fDictionary objectForKey:@"aff"];
      affL.numberOfLines = 0;
      [affL sizeToFit];
      affL.frame = CGRectMake(15.0, 10.0, 220.0, affL.frame.size.height);
      CGFloat affLH = affL.frame.size.height;
      [tableView setRowHeight:affLH+30];
  </code></pre>
  
  <p>I also use</p>
  
  <pre><code>//... heightForRowAtIndexPath
  
  return affL.frame.size.height;
  </code></pre>
  
  <p>How can I fix this problem? </p>