我有表格視圖。 我想動態增加行的高度到一定的大小。 我該怎麼做。 我知道它的一個愚蠢的問題,但仍然找不到解決方案,請幫助我。 我已經使用這個code.But它不工作:動態增加行的高度--iphone
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
UILabel *lblOutTime = [[UILabel alloc]init];
lblOutTime = [[UILabel alloc] initWithFrame:CGRectMake(2, 20, 200, 40)];
lblOutTime.text [email protected]"Outtime : ";
lblOutTime.backgroundColor = [UIColor clearColor];
lblOutTime.font = [UIFont boldSystemFontOfSize:5.0f];
lblOutTime.font = [UIFont fontWithName:@"HelveticaNeue Heavy" size:5.0f];
[cell.contentView insertSubview:lblOutTime atIndex:1];
return cell;
}
這裏我試圖增加標籤高度。我將標籤放在行(單元格)上。 – 2012-03-02 12:39:37
In heightForRowatIndexPath根據你的內容計算高度併爲每個單元格返回適當的值 – 2012-03-02 12:41:10
我的內容是一些字符串值。如果我將傳遞一些靜態高度,那麼將會是確定的。但是我該怎麼做呢?我的知識非常少,因爲我是iPhone的新手。 – 2012-03-02 12:43:38