Atif Alvi
Atif Alvi

Reputation: 498

Xcode 5 not recognizing custom Font

I have Xcode 5.0.1 and I am developing for iOS 7.

I have a custom font file named Roboto-Regular.ttf and it is working perfectly in xcode 4.6.3 but when I add it in xcode 5.0.1 it does not work.

I cannot even preview the ttf file in xcode 5 where as I can preview it in xcode 4.6.

I have tried cleaning my project, restarting xcode 5, restarting mac but no luck.

Any ideas what could be the problem here??

Edited

The ttf Files are present in my "Copy Bundle Resources" list and I have also added the array "Fonts provided by application" in my projectName-info.plist with ttf extension e.g "Item 0 : Roboto-Regular.ttf".

An another thing bugging me is why is the xcode 5 not showing the preview of these font files!!!

Upvotes: 1

Views: 2369

Answers (4)

Jayprakash Dubey
Jayprakash Dubey

Reputation: 36447

Note : Use stable version of Xcode 5.1.1 instead of Xcode 5.0.1 (which is in beta).

You can create custom font in Xcode 5.1.1 using following steps :

  1. Import font type into your project (*.ttf file)
  2. Add “Fonts provided by application” key into plist of your project.
  3. Add custom font as an item array in “Fonts provided by application” key.
  4. Now, you can use font in label as :

    [lblName setFont:[UIFont fontWithName:@“CustomFontName” size:14.0]];

Upvotes: 0

vishnu
vishnu

Reputation: 36

(Solved in Xcode5)

First, have patience and go through this link and recheck the points

Then, along with adding 'Fonts provided by application' in the Plist file, also add the same fonts with extension in 'Project Name' > Info Tab and save.

This worked for me.

Upvotes: 0

Shubham
Shubham

Reputation: 570

Please check your .ttf file present inside the copy bundle respurces! enter image description here

also please check .plist file array and font and file name once.enter image description here

and use below code:

[YOURLable setFont:[UIFont fontWithName:fontname size:15.0]];

Upvotes: 2

Om Prakash
Om Prakash

Reputation: 9461

Add your font className in Fonts provided by application array in Plist.

and set fontName with font Class name. [lbl1 setFont:[UIFont fontWithName:@"Roboto-Regular" size:15]];

its work on Xcode5.0.1.. :)

Upvotes: 1

Related Questions