2011-09-08 44 views
-1

與setAdjustsFontSizeToFitWidth改變字體我想調整的UITableViewCell的標籤字體,所以我使用了下面的代碼:的UITableViewCell爲textLabel不是iphone

static NSString *CellIdentifier = @"ItemCell"; 
UITableViewCell *cell = nil; 
if (cell == nil) 
{ 
    cell = [[[UITableViewCell alloc] 
      initWithStyle:UITableViewCellStyleValue1 
      reuseIdentifier:CellIdentifier] autorelease]; 
    cell.accessoryType = UITableViewCellAccessoryNone; 
} 
if (indexPath.section == 0) 
{ 
    NDOrderItem *item = [self.order.items objectAtIndex:indexPath.row]; 
    //[cell.textLabel setMinimumFontSize:10]; 
    //[cell.textLabel setAdjustsFontSizeToFitWidth:YES]; 
    cell.textLabel.text = item.name; 
    cell.detailTextLabel.text = [NSString stringWithFormat:@"%d",item.quantity]; 
} 

但setAdjustsFontSizeToFitWidth不調整爲textLabel的字體。

回答

0

嘗試使用下面的行viewDidAppear

- (void)viewDidAppear:(BOOL)animated 
{ 
    self.title = @"Table Of Content"; 
    // 
    // set row hight for your tableView 
    tableView.rowHeight = 30; 
} 
+0

這個代碼不工作 –

相關問題