iPhone UIFont boldFont带有名称 [英] iPhone UIFont boldFont With name
问题描述
我看过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!
〜汤米
推荐答案
我想出了答案,那就是使用字体家族的粗体字体:
CourierNewPS-BoldMT
并有效:
I figured out the answer, and that was to use the font-family's bolded version of the font:
CourierNewPS-BoldMT
and that worked :
我通过使用[UIFont fontNamesForFamilyName:@"Courier New"]
方法发现了这一点,该方法返回了Courier New所有不同变体的数组,包括Bolded和Italic等.
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.
这篇关于iPhone UIFont boldFont带有名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!