开发者

UITableViewCell textLabel not changing the font with setAdjustsFontSizeToFitWidth in iphone

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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜