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

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

问题描述

你如何设置字体为粗体和斜体。有一个boldSystemFontOfSize和italicSystemFoneOfSize,但我不能看到设置一个字体的方式是斜体和粗体。



第二个问题,有没有办法在字体上设置下划线,或者只是在文本下画线。

粗体,斜体版本的字体。例如:
$ b $ $ p $ u $ c $ U $ uifont * myFont = [UIFont fontWithName:@Helvetica-BoldObliquesize:[UIFont systemFontSize]];

要获取iPhone上所有可用的列表,请将这个小代码片段放在<$ c $

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

$ / code>

注意:某些字体名称会显示为斜向 - 这与斜体。

我无法看到内置的强调方式 - 您可能必须自己画线。


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]];

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]);
}

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天全站免登陆