且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在ios dev中更改默认字体

更新时间:2022-12-05 15:50:28

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];