【问题标题】:UILabel font : bold and italic [duplicate]UILabel 字体:粗体和斜体 [重复]
【发布时间】:2012-12-10 18:19:17
【问题描述】:

可能重复:
How do I set bold and italic on UILabel of iPhone/iPad?

我正在尝试使用系统字体将 UILabel 字体设置为粗体和斜体,但我不能同时使用这两种样式。那么是否可以使用系统字体使字体变为粗体和斜体?这是我的代码,

lblTitle.font = [UIFont italicSystemFontOfSize:[UIFont systemFontSize]]; 

lblTitle.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]];

我想要我的字体粗体和斜体。 谁能帮我? 提前谢谢你。

【问题讨论】:

  • 也许这会有所帮助:stackoverflow.com/questions/4713236/…
  • 哎呀,Arial 中的拼写错误...这是 Ariel :( 我的运气不好...您可以使用提供的链接中的其他字体。
  • 有人知道 System Font Bold 的答案是什么吗?我找不到上面写着“Apple System Font is ...”的地方

标签: iphone objective-c ios uilabel uifont


【解决方案1】:

试试这个代码...

UIFont *yourFont = [UIFont fontWithName:@"Helvetica-BoldOblique" 
                                   size:[UIFont systemFontSize]];
lblTitle.font = yourFont;

您也可以为 BoldItalik 使用其他字体名称。

Optima-BoldItalic,TimesNewRomanPS-BoldItalicMT,Baskerville-BoldItalic,HelveticaNeue-BoldItalic等...

【讨论】:

    【解决方案2】:

    有几种字体本身包含 Bod+Italic,您可以使用这些字体... 一个常见的例子是

    lblTitle.font = [UIFont fontWithName:@"Arial-BoldItalicMT" size:16.0f];
    

    其他的是:

    - TrebuchetMS-Bold

    - Helvetica-BoldOblique

    - 这个link 会帮助你。

    【讨论】:

    • 第一个不会做 OP 想要的 - 第二个调用会覆盖第一个并且字体只会是斜体。
    • 好的,我要删除那个:)
    猜你喜欢
    • 2011-07-18
    • 2011-06-10
    • 2019-07-20
    • 2016-03-03
    • 1970-01-01
    • 1970-01-01
    • 2016-08-10
    • 2010-11-25
    • 2016-01-02
    相关资源
    最近更新 更多