文档说:
+ (UIFont *)fontWithName:(NSString *)fontName size:(CGFloat)fontSize
The fully specified name of the font. This name incorporates both the font family name and the specific style information for the font.
我找到的例子只指定了一个字体名称。但我还想指定其他属性,例如中等字体粗细等。这是如何编码到名称中的?
最佳答案
参见 this answer用于命名方案。可以找到完整的字体列表(带名称)here .
例子:
[UIFont fontWithName:@"HelveticaNeue-Bold" size:15.0];
更新
添加了 iOS 8.2 this method用于获取不同粗细的系统字体。
例子:
[UIFont systemFontOfSize:15.0 weight:UIFontWeightBold];
关于iphone - 如何使用 +fontWithName :size: and specify both the font family name and the specific style information for the font? 创建字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10400398/