【问题标题】:How to Set Custom Font to UILabel in Storyboard如何在 Storyboard 中将自定义字体设置为 UILabel
【发布时间】:2014-10-15 00:00:09
【问题描述】:

我想在情节提要中将自定义字体设置为 UILabel。我有字体的 .ttf 文件。我在谷歌上搜索过,每个人都在以编程方式设置字体。

【问题讨论】:

标签: ios objective-c iphone fonts


【解决方案1】:

选择控件(标签)并添加User Defined Runtime AttributeKey Path设置为fontNameType 设置为 StringValue 设置为自定义字体的名称)。

注意:

确保您已将字体添加到项目中 - tutorial

【讨论】:

【解决方案2】:

将您的 IBOutlet 连接到 Label,您可以这样设置,

lblHeading.font = [UIFont fontWithName:@"ApexNew-Bold" size:17];

in the above code ApexNew-Bold is custom font and you need to add it in Plistfile.

【讨论】:

  • 这可以正常工作。我想在情节提要中做到这一点。
【解决方案3】:

好消息是,这是 Xcode 6 中的 Interface Builder 中添加的一项新功能,如文档中所述 here

【讨论】:

  • @pawan 您需要使用您的开发者帐户登录到 developer.apple.com
猜你喜欢
  • 2013-06-05
  • 1970-01-01
  • 2014-09-11
  • 1970-01-01
  • 2015-04-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-18
  • 1970-01-01
相关资源
最近更新 更多