iPhone UIFont 粗体字体 带名称
我查看了 UIFont 的标头,但它具有所有类方法,只有一个实例方法和一些无用的属性。我想知道如何将字体设置为具有字体名称和粗体字体粗细,类似于 [[UIFont alloc] initWithFontName:@"Courier New" Weight:@"Bold" size:14];.感谢您提前提供任何帮助!
~汤米
I have looked at the headers for UIFont
but it has all class methods and only one instance method and some useless properties. I would like to know how to set the font to have a font name, and bold font weight kinda like [[UIFont alloc] initWithFontName:@"Courier New" weight:@"Bold" size:14];
. Thanks for any help in advance!
~Thommy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我找到了答案,那就是使用字体系列的粗体版本字体:
CourierNewPS-BoldMT
并且有效:我通过使用
[UIFont fontNamesForFamilyName:@"Courier New"]
方法发现了这一点,该方法返回 Courier 所有不同变体的数组新的包括粗体和斜体等。I figured out the answer, and that was to use the font-family's bolded version of the font:
CourierNewPS-BoldMT
and that worked :I found this out by using the
[UIFont fontNamesForFamilyName:@"Courier New"]
method which returned an array of all the different variations of Courier New including, Bolded and Italic etc.我向 UIFont 添加了一个类别来执行此操作,前提是字体的粗体版本包含粗体一词...
I added a category to UIFont to do this, provided the Bold version of the font contains the word bold...
Google 搜索会显示这个列表可用的 iPhone 字体名称。
A Google search turns up this list of available iPhone font names.