Embedding custom fonts

suggest change
Custom Font Support Applications that want to use custom fonts can now include those fonts in their application bundle and register those fonts with the system by including the UIAppFonts key in their Info.plist file. The value of this key is an array of strings identifying the font files in the application’s bundle. When the system sees the key, it loads the specified fonts and makes them available to the application.

Once the fonts have been set in the Info.plist, you can use your custom fonts as any other font in IB or programatically.

  1. Drag and drop your font to Xcode Supporting Files folder. Don’t forget to mark your app at “Add to targets” section. From this moment you can use this font in IB and choose it from font pallet.
  1. To make this font available on the device, open Info.plist and add Fonts provided by application key (UIAppFonts). Add font name as the value to the Item 0 key. Note: Font name can vary from your font file name.
  2. Get the custom added font name using below snippet

[Swift 3]

for family in UIFont.familyNames {
            print("\(family)")

            for name in UIFont.fontNames(forFamilyName: family) {
                print("   \(name)")
            }
        }

[Objective - C]

for (NSString *familyName in [UIFont familyNames]){
        NSLog(@"Family name: %@", familyName);
        for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
            NSLog(@"--Font name: %@", fontName);
        }
    }

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Custom Fonts:
* Embedding custom fonts

Table Of Contents
12 UIView
15 UIColor
26 UIImage
28 CALayer
30 NSDate
31 Custom Fonts
40 iBeacon
49 NSTimer
79 NSURL
87 AWS SDK
96 NSData
101 Segues
104 EventKit
105 NSBundle
106 SiriKit
111 StoreKit
117 3D Touch
119 Keychain
122 Block
141 AirDrop
144 UISlider
145 Carthage
146 HealthKit
151 plist
157 MVVM
164 UIPhoenix
166 Simulator
168 NSArray
169 OpenGL
175 Core Data
179 MyLayout
180 UIFont
189 Security
200 Codable