如何在ios dev中更改默认字体 [英] How can I change default font in ios dev
本文介绍了如何在ios dev中更改默认字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
经过一些Google搜索,现在我可以使用自定义字体。像这样:
After some googling, now I can use custom font. like this:
[loginButton.titleLabel setFont:[UIFont fontWithName:@"OpenSans-Bold" size:15]];
您无法在界面构建中选择自定义字体,因此您需要一次写入代码
you can not choose custom font in interface build, so you need write code again and again
我的问题是:如何将应用程序默认字体更改为自定义字体
My question is: how can I change application default font to a custom font
推荐答案
p> i不会改变系统的字体=)
i would not alter the system font =)
最好的方法是创建一个函数,返回你想要的字体:
best way is to create a function that will return the font you wish like this:
-(UIFont *)getFont
{
UIFont *font = [UIFont fontWithName:@"OpenSans-Bold" size:15];
return font;
}
,然后在任何地方你可以这样做按钮作为示例)
and then wherever you need that font you can do it like this (using your button as example)
[loginButton.titleLabel setFont:[self getFont];
这篇关于如何在ios dev中更改默认字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文