2

I have my own fontIcon list in the project. I have added it to my plist. When I try the following code it works correctly:

myLabel.text = @"\uE100"; 
//This is my font icon code 

But when I try to get the font icon code from another string it wont work.

NSString* theFont = [NSString stringWithFormat:@"\\u%@",@"E100"];
myLabel.text = thefont;

Is there any special type for icons? what should I do to get the font icon from my API?

Niloufar
  • 512
  • 1
  • 5
  • 24
  • your font file should be in app local, you can find so tutorial on "how to add custom font in ios app over google." – Pawan Rai Mar 08 '17 at 08:40
  • you can't split up the \uE100 like that. I don't know where you are storing or creating E100, but it is at the point that you create a string @"\uE100" – Jon Rose Mar 08 '17 at 08:59
  • @pawan my .tff file is added to my project – Niloufar Mar 08 '17 at 09:07
  • @JonRose I'am getting the icon title from my api, I tried to get the whole string like @"\uE100" but it still doesn't work – Niloufar Mar 08 '17 at 09:07
  • I've use https://github.com/PrideChung/FontAwesomeKit/tree/master/FontAwesomeKit and have been impressed with how they organized there code to solve the same problem (displaying icons in text using a custom font). Perhaps looking over their code could help you. Or you can make a custom subclass of `FAKIcon` which does most of this work for you. – Jon Rose Mar 08 '17 at 09:34
  • @Niloufar did you get any help from my answer, if so then please upvote and accept it as answer. – Pawan Rai Mar 08 '17 at 16:49
  • @Niloufar did you get any help from my answer or should i remove it? – Pawan Rai Mar 14 '17 at 16:44
  • @pawan thanks but it doesn't work – Niloufar Mar 15 '17 at 07:33
  • @Niloufar okay, i have deleted my answer. but the fact is you can seperate a unicode charater in two part & merge them later on. If you find any solution, please post it here as well. – Pawan Rai Mar 15 '17 at 07:36

0 Answers0