How setText custom font in Objetive-C?

Viewed 39

I have a custom font with some symbols and I can set the text to a label in a table view, getting the symbol correctly, as follows:

cell.icono.textColor=[UIColor purpleColor];
[cell.icono setFont:[UIFont fontWithName:@"icomoon" size:17]]; 

const char *icon = "\ue904";
[cell.icono setText:[NSString stringWithUTF8String: icon]];

Now, I am storing in my database the symbols (as string) \ue904, \ue90b, etc, and I get them correctly, I see them in the console without problems, but when I do the following I do not see the symbol, only the string "\ue904"

cell.icono.textColor=[UIColor purpleColor];
[cell.icono setFont:[UIFont fontWithName:@"icomoon" size:17]];

const char *icon = [gridprinc.icono UTF8String];
NSLog(@"%s", icon);
[cell.icono setText:[NSString stringWithUTF8String: icon]];

In the same way, if I do the following, everything works fine

cell.icono.textColor=[UIColor purpleColor];
[cell.icono setFont:[UIFont fontWithName:@"icomoon" size:17]];

NSString *icon = @"\ue907";   
[cell.icono setText:icon];

But when getting the string from CoreData, the label doesn't show the symbol, but the console correctly shows the string:

cell.icono.textColor=[UIColor purpleColor];
[cell.icono setFont:[UIFont fontWithName:@"icomoon" size:17]];

NSString *icon = gridprinc.icono;
[cell.icono setText:icon];
0 Answers
Related