Custom Font in ios not working

前端 未结 17 1863
北海茫月
北海茫月 2020-12-07 22:53

I want to use HelveticaNeue-UltraLight in my ios application. I\'m adding the font file as a resource to my project and adding the \"Fonts provided by application\" key in t

相关标签:
17条回答
  • 2020-12-07 23:21

    Try this this will be also heleful for you.

        [compete_Label setFont:[UIFont fontWithName:@"Helvetica-Bold" size:12]];
    
    0 讨论(0)
  • 2020-12-07 23:22

    I ended up buying the font Helvetica Neue UltraLight from a third party, added it with no problems.

    0 讨论(0)
  • 2020-12-07 23:23

    While this probably won't help the OP, it might be useful to others.

    With iOS 5, Helvetica Neue is automatically included; you don't have to add this custom font to the bundle. It's even possible to use that font family directly from Interface Builder, which is extremely handy.

    0 讨论(0)
  • 2020-12-07 23:23

    In addition to:

    • adding the font file names to the info.plist under "Fonts provided by application"
    • adding the actual files to the project.

    You also have to make sure that under Targets -> Build Phases -> Copy Bundle Resources has the actual filenames of the custom fonts.

    To check if they have appeared, you can do something like:

            UIFont.familyNames.forEach { (name) in
            print(name)
        }
    
    0 讨论(0)
  • 2020-12-07 23:25

    after adding Font file in Bundle "Font Provided by Application" property click on drop down arrow and enter your font name with extension

    0 讨论(0)
提交回复
热议问题