我在tableview中做了一些自动换行,因为有些值很大,它们离开了屏幕的边缘.
但是,字体和大小与粗体不匹配表视图的默认设置,并希望有人可以帮我解决这个问题.
这就是我要设置的字段:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellText = @"Go get some text for your cell.";
UIFont *cellFont = [UIFont fontWithName:@"Helvetica" size:17.0];
CGSize constraintSize = CGSizeMake(280.0f, MAXFLOAT);
CGSize labelSize = [cellText sizeWithFont:cellFont constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap];
return labelSize.height + 20;
}
Run Code Online (Sandbox Code Playgroud)