title: Table view cell expand or contract with the size of the text
body: <p>I have been populating a <strong>UITable view cell</strong> with the data fetched from a database. The length of the data varies for different cells. So i need to <strong>expand or Contract the height</strong> depend the data length. Presently i am using a <strong>custom cell</strong> with the following code.</p>
  
  <pre><code>-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  
      static NSString *cellID= @"customcell4fan";
      customcell4fan *cell = (customcell4fan *)[tableView dequeueReusableCellWithIdentifier:cellID];
  
      if(cell==nil)
      {
          NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"customcell4fan" owner:nil options:nil];
  
          for(id currentObject in nibObjects)
          {
              if([currentObject isKindOfClass: [customcell4fan class]])
              {
                  cell = (customcell4fan *)currentObject;
              }
  
          }
      }
  
  eleme = [xmlElementObjects objectAtIndex:indexPath.section];
  
  NSString *email= [eleme.title stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" \n\t"]];
      NSString *postData= [eleme.description stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" \n\t"]];
  cell.nameLabel.text=email;
      cell.postLabel.text=postData;
  
    return cell;
  
  }
  </code></pre>