更改 UILabel 中的字体名称和粗细(iPhone SDK)
也许我看错了地方,但是如何设置 UILabel 的字体及其粗细?
查看文档,似乎只有创建具有给定字体名称和大小的 UIFont 的方法,例如
[UIFont fontWithName:@"Helvetica" size:22])
或创建粗体字体,以及
[UIFont boldSystemFontOfSize:22]
如何将它们一起使用?
Maybe I'm looking at the wrong place, however how do I set an UILabel's font and AND its weight?
Looking at the documentation, there seems to be only methods to create an UIFont with a given font name and size, like
[UIFont fontWithName:@"Helvetica" size:22])
OR create a bold font, with
[UIFont boldSystemFontOfSize:22]
How can I use these both together?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
fontWithName:size: 的文档指出,“...名称包含字体系列和字体的特定样式信息。”
所以你可能想要:
fontNamesForFamilyName: 可以方便地获取给定系列的可用字体列表。
例如:
...输出:
The documentation for fontWithName:size: states, "...name incorporates both the font family and the specific style information for the font."
So you probably want:
fontNamesForFamilyName: is handy for getting a list of available fonts for a given family.
For example:
...which outputs: