I am using UITableViewCellStyleValue2
and UITableViewStyleGrouped
.
Let's start with some code (it's not 100% complete, but I have tried to include the code needed to hopefully decipher what I am doing, and maybe doing wrong):
#define CELL_FONTSIZE 15.0f
CGSize textSizeValue2 = {207.0f, 9999.0f};
if ([value isEqual: CELL_4]) {
CGSize size = [cell4String sizeWithFont:[UIFont boldSystemFontOfSize:CELL_FONTSIZE] constrainedToSize:textSizeValue2 lineBreakMode:UILineBreakModeWordWrap];
size.height += CELL_HEIGHT; // top and bottom margin
result = MAX(size.height, 44.0f); // at least one row
For this particular cell, the result for the height comes out to 214 both for 3.0 and 3.1
Here's the code for the cell:
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier] autorelease];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.textLabel.numberOfLines = 0;
cell.detailTextLabel.numberOfLines = 0;
cell.clearsContextBeforeDrawing;
if ([value isEqual: CELL_4]) {
cell.textLabel.text = @"About";
cell.detailTextLabel.text = cell4String;
So basically, for 3.0 and 3.1 the exact same thing is happening, but when running the app in 3.0 simulator, the last line seems to get cut off if the cell.detailTextLabel.numberOfLines
has more than three lines of text. The strange thing is that the text is just cut off, but the cell is drawn at the correct height in 3.0, there's just a big blank whitespace underneath the cell.
Anyone know why this is different between 3.0 and 3.1 ? I know I am using a beta of Xcode, but it's pretty strange that it works in the beta and not in 3.0 because, as far as I can see, I am not doing anything too crazy, but something basic.
Thanks