Introduction of third-party fonts and icons in iOS
Using the Swift language, introduce fontawesome
1. Download Font Awesome (official website: http://fortawesome.github.io/Font-Awesome/ )
2. Import the *.ttf file from the font into the project
3. Configure Info.plist file, add Fonts provided by application adding item, and set to *.ttf
4, write icon key value pairs (can write their own, I downloaded from the Internet, address forgot)
5. Use
Define label label
var lab=UILabel(frame: cgrectmake(+ , +, +))
Set font
Lab. font=uifont(name: "Fontawesome", Size: 50.0)
Get the icon based on the key and set the lab content
Lab. text= GetFontawesomebykey("user");
Show to Page
Self. View. Addsubview(Lab)
6. Operation Effect
The first time to write a blog, lack of experience, a lot of forgiveness, some resources from the network. If you have any questions, please contact me qq:623971951
Swift uses the Font Awesome