1

I am trying to FontAwesome in my iPhone app. I have set Up all things.

But every time I am getting this ?(question)mark Image . I am sure that I have added the font Correctly In my Project and also in Plist:

Here is my Project Setup:

Step 1:

Added Font Awesome File in My project

enter image description here

Step :2

Installed Font Awesome in my Mac.

enter image description here

Step : 3

Add Key In my pList File.

enter image description here

Step 4:

For Confirmation Checked the Font List in Storyboard:

enter image description here

Step 5:

Created a UILabel Programmatically and setting font like this:

 UILabel *lblFontAwesome = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 400)];
lblFontAwesome.center = self.view.center;
lblFontAwesome.font = [UIFont fontWithName:@"FontAwesome" size:35];
[lblFontAwesome setText:@"\uf014"];

[self.view addSubview:lblFontAwesome];

Step 6: I have added Some Category files also.

enter image description here

Step 7:

Here what I am getting:

enter image description here

I tried different solutions on net and also from SO.One is this . But None of them seems to work. I am always getting this ?.

Note when i try %C then I am getting this Image: enter image description here And yes with a warning: and Also this is not the correct icon. It's just showing unknown image.

enter image description here

Cœur
  • 37,241
  • 25
  • 195
  • 267
Rahul
  • 5,594
  • 7
  • 38
  • 92

1 Answers1

5

I am sure that I have added the font Correctly In my Project and also in Plist

Well, don't be sure. Clearly you have not added it correctly.

The problem is that, although the font file is in your project, it is not being copied into your app. Thus, it is not available in the running app.

Here's how to fix that.

In the project navigator (your first screen shot), select the FontAwesome.ttf file. Now look at the File inspector on the right. Now look at the Target Membership section. Make sure that the app target is checked.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Now I have added but even then I am not getting icons :( – Rahul Feb 09 '16 at 14:58
  • 2
    Also please note that nothing you can do will cause FontAwesome to work in your launch screen. It will work only in the app once it has _finished_ launching. – matt Feb 09 '16 at 14:59
  • 2
    Oh, one more thing. I would not expect setting the font in Interface Builder to work (your step 4 screen shot). You must set the font _in code_. And when you do, make sure you are getting its name right; I doubt that `"FontAwesome"` is its correct PostScript name. – matt Feb 09 '16 at 15:01
  • Thanks Your advice works..And Is working fine . You save my day – Rahul Feb 09 '16 at 15:08
  • 2
    I'm happy I was able to help! – matt Feb 09 '16 at 15:10