开发者

UITableViewCell textLabel not changing the font with setAdjustsFontSizeToFitWidth in iphone

开发者 https://www.devze.com 2023-04-03 22:41 出处:网络
I want to adjust the UITableViewCell\'s label font so i have used the following code: static NSString *CellIdentifier = @\"ItemCell\";

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

精彩评论

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

关注公众号