iOS: How can i set a non system font family, style, size of UILabel?

前端 未结 2 991
生来不讨喜
生来不讨喜 2021-01-14 16:35

I am trying to use a font which is not a system font in the bottom way

[pickerLabelLeft setFont:[UIFont fontWithName:@\"DaxOT-Bold\" size:20]];
[pickerLabelL         


        
2条回答
  •  时光说笑
    2021-01-14 17:19

    1. Download the font.
    2. Drag and drop the different font family in your project.
    3. Add the font family in .plist file (Fonts provided by application).
    4. Check whether your font family is added in your "Build Phases" or not.
    5. Now select a "New file" in your project and add a ".h" file in the project.
    6. In the ".h" file enter "#define any_name@"font_name"
    7. Now define it in the label setFont......

    You're all done but remember don't add the ".ttf" with your "font_name".

    Thanks!

提交回复
热议问题