iPhone 上的斜体、粗体和下划线字体 [英] italic, bold and underlined font on iPhone

查看:125
本文介绍了iPhone 上的斜体、粗体和下划线字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将字体设置为粗体和斜体.有一个boldSystemFontOfSize 和italicSystemFoneOfSize,但我看不到将字体设置为斜体和粗体的方法.

How do you set a font to be both bold and italic. There is a boldSystemFontOfSize and italicSystemFoneOfSize, but I can't see the way to set a font to be both italic and bold.

作为第二个问题,有没有办法在字体上设置下划线,或者你只是在文本下画一条线.

As a second question, is there a way to set an underline on a font, or do you simply draw a line under text.

推荐答案

您必须实际要求字体的粗体、斜体版本.例如:

You have to actually ask for the bold, italic version of a font. For example:

UIFont *myFont = [UIFont fontWithName:@"Helvetica-BoldOblique" size:[UIFont systemFontSize]];

要获取 iPhone 上所有可用内容的列表,请将这个小片段放在您的 applicationDidFinishLaunching: 委托方法中并查看日志输出:

To get a list of everything available on the iPhone, put this little snippet in your applicationDidFinishLaunching: delegate method and look at the log output:

for (NSString *family in [UIFont familyNames]) {
    NSLog(@"%@", [UIFont fontNamesForFamilyName:family]);
}

注意:有些字体名称表示oblique" - 这与斜体相同.

Note: Some font names say "oblique" - this is the same as italic.

我看不到一种内置的下划线方式 - 您可能必须自己画线.

I can't see a built-in way of doing underlines - you may have to draw the line yourself.

这篇关于iPhone 上的斜体、粗体和下划线字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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