Using Icon Font with LThemeManager
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:
- Download icon fonts and add them in your project like regular fonts. You can start with FontAwesome.
- Download zip, unzip, and find the
OTFis supposed to be a “better” version than
- Install the font in your OS X.
- Drag the font file into your project in Xcode.
- Create a
Fonts provided by applicationkey in your info.plist file.
FontAwesome.otfinto the newly created array.
- Create a button and configure it like this:
- Your button will look like this:
- 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.