iOS 字体 - 为什么 Interface Builder 为您提供更多字体选项?例如HelveticaNeue-Medium?
我查看了以下链接:
通过代码设置 UILabel - 字体 -生成错误 - iPhone
它提供了查看所有可用 iOS 字体的代码。对于 HelveticaNeue,我们得到以下内容:
HelveticaNeue-Italic HelveticaNeue-Bold 字体 Helvetica新粗体斜体 HelveticaNeue
为什么 Interface Builder 提供了大量其他字体选项?我已经放下了 UILabel,我看到了 HelveticaNeue-Medium 和 HelveticaNeue-Light 的选项,它们在编译时似乎工作正常?
我问的原因是我现在正在以编程方式生成 UILabel 并希望将其字体设置为 HelveticaNeue-Medium 但看起来这不是一个选项?!
I've looked at the following link:
Setting UILabel - Font through code - generates error - iPhone
Which provides code to see all the available iOS fonts. For HelveticaNeue we get the following:
HelveticaNeue-Italic
HelveticaNeue-Bold
HelveticaNeue-BoldItalic
HelveticaNeue
Why does Interface Builder provide a slew of other options for fonts though? I've plopped a UILabel down and I see options for HelveticaNeue-Medium and HelveticaNeue-Light for example and they seem to work fine when compiling ?
The reason I'm asking is that I'm now programmatically generating a UILabel and would like to set it's font to HelveticaNeue-Medium but it looks like that's not an option?!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然 Interface Builder 允许您选择任何字体,但如果该字体不可用,则默认为 Helvetica。据我所知,它也编译为 Helvetica(或系统默认值,显然不是 iPhone 4 上的 Helvetica)。
或者,至少,自定义字体在 IB 中不起作用;我必须将它们设置为 -awakeFromNib 或 -viewDidLoad:(不,这不是 UIAppFonts 问题)。
While Interface Builder lets you pick any font, it defaults to Helvetica if the font isn't available. As far as I know, it also compiles down to Helvetica (or the system default, which apparently isn't Helvetica on iPhone 4).
Or, at least, custom fonts don't work in IB; I have to set them in -awakeFromNib or -viewDidLoad: (no, this is not a UIAppFonts problem).
Interface Builder 显示 Mac 上可用的所有字体。并非所有这些都适用于 iOS。在使用字体之前,请确保该字体在 iOS 上可用。
The Interface Builder shows all fonts available on the Mac. Not all of them are available to iOS. Before using a font, make sure that is available on iOS.