How to use a custom font
Before you speak the icon font, first look at how normal custom fonts are used in iOS, and the two principles are the same. Here take Kaushanscript-regular as an example:
Step 1: Import font files
Drag a font file into the project (iOS supports font formats:. TTF,. OTF, other formats are not determined):
Then, in the project's resource pool, confirm that the font files are joined to the project, open the Xcode project in build phases to view:
Step 2: Configure the. plist file
UILabel *label5 = [[UILabel alloc] Initwithframe:cgrectmake (Ten, 480, +)];label5.text = @ "\u0000e42a\u0000e525\ U0000e41c "; [Self.view Addsubview:label5];
6. Effects
7. Use the homemade icon font
If the icon library described above does not meet your needs, or if the desired icon is distributed across multiple icon libraries and cannot be centralized into a single font file, then you may need to make an icon font file yourself.
Summarize
In this way, in iOS development, not only can go directly to open-source icon library to find ready-made icons used in the project, but also can easily change the color of the icon, size, I believe that can liberate a lot of designers and engineers work.
On the Code
Icon Font Library
- Fontello
- Etao Icon Font Library (here is a question to note that the Etao icon font named "Untitled1", is not the generation of the font of the classmate negligence? )
- Icomoon
- Emoji Expression Gallery
iOS text icon