我正在尝试显示地址,因为它显示在 iPhone 的联系人应用程序中。所以看来我需要一个高度是普通细胞三倍的细胞。因为它总是一样的,所以我只需要对代码应用一个固定的高度。但我不知道该怎么做。我目前的代码是
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *address = [NSString stringWithFormat:@"%@\n"@"%@ %@ %@\n"@"%@", dispAddress, dispCity, dispState, dispZip, dispCountry];
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.detailTextLabel.numberOfLines = 3; // 0 means no max.
cell.detailTextLabel.text = address;
return cell;
}