Raheel Sadiq
Raheel Sadiq

Reputation: 9867

custom font iphone

I am trying to add a custom font in my app, searched the web, there are many posts but i am getting error

InfoPlist.strings:0: error: validation failed: The data couldn’t be read because it has been corrupted.

i dont get what's the issue, i added a new file of font in my project and added this code in plist, i never used plist before

<key>UIAppFonts</key>
<array>
<string>CloisterBlack.ttf
</string>
</array>

Upvotes: 1

Views: 555

Answers (4)

Raheel Sadiq
Raheel Sadiq

Reputation: 9867

Add font in plist, then check the name of your font, by double clicking the font file in finder, like in my case the name of the font is Abduction for the font file name "CloisterBlack.ttf"

then access it like

[UIFont fontWithName:@"Abduction" size:20.0];

Upvotes: 4

Romit M.
Romit M.

Reputation: 898

just use this class for custome fonts

Upvotes: 1

TheTiger
TheTiger

Reputation: 13354

I think your font file has been corrupted. Add it again and then try. This link will help you Add Custom Font in your app. Make sure your file should be .ttf . Do you have any .ttf file or not ? If YES then add it to you project folder and then make little changes in your info.plist file.

enter image description here

If you dont have any .ttf file then download it first. It is your font file.

Upvotes: 2

ggfela
ggfela

Reputation: 1152

I think adding the extension will fix it, my plist files look the same.

<key>UIAppFonts</key>
<array>
<string>CloisterBlack.ttf</string>
</array>

Upvotes: 1

Related Questions