I want to adjust the UITableViewCell's label font so i have used the following code:
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 setAdjus开发者_JAVA技巧tsFontSizeToFitWidth:YES];
cell.textLabel.text = item.name;
cell.detailTextLabel.text = [NSString stringWithFormat:@"%d",item.quantity];
}
but the setAdjustsFontSizeToFitWidth is not adjusting the font of the textLabel.
Try to use the following line under viewDidAppear
- (void)viewDidAppear:(BOOL)animated
{
self.title = @"Table Of Content";
//
// set row hight for your tableView
tableView.rowHeight = 30;
}
精彩评论