Using Icon Font with LThemeManager

 Published On May 08, 2015

OK, actually LThemeManager doesn’t do much here, but I want to share it because it’s pretty neat to work with Icon Fonts. Basically what you have to do is:

  1. Download icon fonts and add them in your project like regular fonts. You can start with FontAwesome.
  2. Download zip, unzip, and find the OTF / TTF file. OTF is supposed to be a “better” version than TTF.
  3. Install the font in your OS X.
  4. Drag the font file into your project in Xcode.
  5. Create a Fonts provided by application key in your info.plist file.
  6. Add FontAwesome.otf into the newly created array.
  7. Create a button and configure it like this:
    Attributes Inspector
  8. Your button will look like this:
  9. And in simulator:

Not a single line of code is needed here. And you may like to copy / paste the the button around so that you don’t need to set the font name / user font name again, and replace the icon with a new one in the FontAwesome cheatsheet.

The advantages are obvious here. You don’t have to drag around and manage a lot of separated icon files here and there, you can easily resize and change color of font icons (or add shadow, you name it), and your web developer buddy may feel good about you. Anyway, these are just basic icons but it’s pretty good for mock up and stuff.



comments powered by Disqus