adit adit - 1 year ago 217
iOS Question

How to integrate and use Font Awesome with Objective-C or Swift in an Xcode project?

So I am trying to use this font I've added the font as a resource and put it in the plist file. Here's how I am using it:

[homeFeedButton.titleLabel setFont:[UIFont fontWithName:@"fontawesome" size:8]];
NSString *str = [NSString stringWithFormat:@"%C", @"\f030"];

However this doesn't work. Does anyone know how to use this font in an Xcode project?

Answer Source

It is because your +[NSString stringWithFormat:] method contains the literal for a unichar, not an NSString, which is an object that uses %@, which is beside the point because literal'ing a literal is redundant.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download