如何创建粗体UIFont [英] How to create bold UIFont

查看:91
本文介绍了如何创建粗体UIFont的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的tableview中做了一些自动换行,因为有些值非常大,它们离屏幕边缘不足。

I am doing some word wrapping in my tableview as some of the values are so big they go off the edge of the screen.

然而,字体和大小和粗体剂量不符合表格视图的默认设置,并希望有人可以帮助我解决这个问题。

However, the font and size and boldness dose not match the default settings of the table view and was hoping someone could help me fix that up.

这是我正在设置的字段:

This is what I am doing to set the fields:

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


推荐答案

如果您正在使用在iOS中捆绑的Helvetica版本,你可以简单地做:

If you're using the version of Helvetica that is bundled in iOS, you can simply do:

[UIFont boldSystemFontOfSize:17.0];

这篇关于如何创建粗体UIFont的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆