Adding and Using Custom Font in iOS
Custom font can be easily added and used in iOS 3.2 or above. Yet it is a very popular question on for iOS Developers.
Here are the steps:
Add the otf/ttf font into your Resources folder. The name of my font is BentonSansComp-Book.otf
Edit info.plist and add a key call
UIAppFonts
– value type should beArray
. The friendly name forUIAppFonts
isFonts provided by application
.In
item0
of the array enter the name of the font you added — in my case, BentonSansComp-Book.otfFind the font name.
IMPORTANT: The font name is not necessary the filename. Open with Font Book.app > Show font info > look for PostScript name. That’s the font name you should use. For my font, it happens that the filename == font name.
Unfortunately, Xcode interface builder does not let you change to your custom font. So you got to code it!
1
|
|