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

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


In Swift:

Font Awesome Cheatsheet.

Tutorial on how to integrate the font called "Font Awesome" in your Xcode project.

Common Mistakes With Adding Custom Fonts to Your iOS App

let label = UILabel(frame: CGRectMake(0, 0, 100, 100))label.font = UIFont(name: "FontAwesome", size: 40)let myChar: UniChar = 0xF180label.text = String(format: "%C", myChar)self.view.addSubview(label)


BEST solution for FA with XCode:

  1. Copy the icon you want from http://fontawesome.io/cheatsheet/ (I mean mark and copy the icon itself):

enter image description here

  1. Then add a label to your storyboard, and on its properties:

enter image description here

  • RED - Choose FontAwesome as family
  • GREEN - Set the size you want
  • BLUE - Paste here what you copied in the 1st step. (dont worry about the question mark - in the view you should see it properly).

That's it.

If you need to change the icon in the code - you can paste 1st step inside your code too:enter image description here


Not sure you ever got this working properly, but there's now a couple of nice projects on github:

https://github.com/alexdrone/ios-fontawesome - which gives you a category for NSString which offers basic help using FontAwesome.

and https://github.com/leberwurstsaft/FontAwesome-for-iOS which gives you a NSString category with fontAwesomeIconStringForIconIdentifier and also an UIImageView subclass: FAImageView