- 在我的應用程序中,我有一個單元格樣式值爲2的表視圖:(單元格並排有兩個標籤)。
- textLabel,我顯示的時間:顯示在timeLable中。
- 在detailTextLable,我顯示這是在commentsTextView
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier] autorelease];
cell.detailTextLabel.numberOfLines = 0;
cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
}
cell.textLabel.text = timelabel.text;
cell.detailTextLabel.text = commentTextView.text;
}
//int x = cell.commentTextView.frame.size.height;
}
cell.detailTextLabel.textAlignment = UITextAlignmentLeft;
cell.textLabel.textAlignment = UITextAlignmentLeft;
return cell;
}如何根據iPhone中的detailTextLabel中的文本大小增加單元格大小。
我需要擴大我對於單元尺寸進入評論到樂在文本視圖中輸入的一系列註釋:detailTextLabel中顯示的「commentTextView」。
但在textLable(timelable文本)的區別,它不隨detailTextLabel
擴大該怎麼辦?
- (CGFloat的)的tableView:(UITableView的*)的tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 的NSString * cellText = nil; UIFont * cellFont = nil; cellText = commentsTextView.text; cellFont = [UIFont fontWithName:@「Helvetica-Bold」size:19.0]; CGSize constraintSize = CGSizeMake(280.0f,MAXFLOAT); CGSize labelSize = [cellText sizeWithFont:cellFont constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap]; return labelSize.height + 10; } – 2012-01-30 12:19:39
你的回答對我這個方面很有幫助 – 2012-01-30 12:20:13