Objective c UITableViewCell textLabel在iphone中不使用setAdjustsFontSizeToFitWidth更改字体
我想调整UITableViewCell的标签字体,因此使用了以下代码:Objective c UITableViewCell textLabel在iphone中不使用setAdjustsFontSizeToFitWidth更改字体,objective-c,Objective C,我想调整UITableViewCell的标签字体,因此使用了以下代码: static NSString *CellIdentifier = @"ItemCell"; UITableViewCell *cell = nil; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifie
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没有调整文本标签的字体。尝试使用ViewDidDisplay下面的行
- (void)viewDidAppear:(BOOL)animated
{
self.title = @"Table Of Content";
//
// set row hight for your tableView
tableView.rowHeight = 30;
}