Thank you for your replies, I will put the code here. But remember that my code works well for all other cells, so it had to be related with the specific content of this cell, but it is just some text in a UILabel...
Do not hesitate to check out the video I have made, it is a very curious behaviour for the iPhone, have your even seen that ? dl.free.fr/rlQmFyWS0
Here is the code for cellForRowAtIndexPath: method, just the part concerned by the description cell :
case 3: // A big cell containing the description
{
// Try to find an already allocated cell with the description (note : there is only one description cell per table so no need to check the content...)
UITableViewCell * descriptionCell = [tableView dequeueReusableCellWithIdentifier:kTextCellIdentifier];
if (descriptionCell == nil) {
// As a frame, use the description label's one plus a little margin for the height
descriptionCell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, self.descriptionText.frame.size.height + (2*kCellInset)) reuseIdentifier:kTextCellIdentifier] autorelease];
descriptionCell.selectionStyle = UITableViewCellSelectionStyleNone;
// The descriptionText UILabel has been previously initialized properly by tableview:heightForRowAtIndexpath: method
[descriptionCell.contentView addSubview:self.descriptionText];
}
return descriptionCell;
And here is the part where I initialized the descriptionText field :
// Customize row height for each cell
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 3) {
CGSize realSize;
if (self.descriptionText != nil) {
// the description has been previously initialized
realSize = descriptionText.frame.size;
}
else {
// We need to dynamically resolve the height for the description zone
NSString * desc = (NSString *)[product objectForKey:@"description"];
UILabel * descLabel = [[UILabel alloc] initWithFrame:CGRectZero];
// Unlimited number of lines
descLabel.numberOfLines = 0;
descLabel.text = desc;
// Set a preferred width and anything for the height
realSize = [descLabel sizeThatFits:CGSizeMake(tableView.frame.size.width - (2*kCellInset), 1)];
// Take the opportunity to set the frame with the correct values
descLabel.frame = CGRectMake(kCellInset, kCellInset, realSize.width, realSize.height);
self.descriptionText = descLabel;
[descLabel release];
}
return (realSize.height + (2*kCellInset));
}
else {
return kImageCellHeight;
}
return 0;
}
Any guess would be more than welcome... I keep investigating here