So I am trying to use this font http://fortawesome.github.com/Font-Awesome/. I\'ve added the font as a resource and put it in the plist file. Here\'s how I am using it:
I was looking for the helper library for Swift3 and found this to be very simple and working solution https://github.com/Syndicode/FontAwesomeKitSwift3. It has animations that explain for novices like me how to include it and use quickly.
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 = 0xF180
label.text = String(format: "%C", myChar)
self.view.addSubview(label)
BEST solution for FA with XCode:
That's it.
If you need to change the icon in the code - you can paste 1st step inside your code too:
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
You can just use the literal code string by affixing it with \u
.
e.g. You can use \f030
in your iOS app using the following snippet.
[[[UILabel alloc] initWithFrame:CGRectZero] setText:@"\uf030"];
not sure if this answer will be useful looking at the date you posted your question.... but to help someone maybe who is doing it at the moment,
[self.homefeedbutton setTitle:@"o" forState:UIControlStateNormal]; [self.homefeedbutton.titleLabel setFont:[UIFont fontWithName:@"fontawesome" size:30]];
setTitle:@"o" o is a name of the font, don't use the unichar, instead rename your font to something else preferable a letter, e.g if you check fontello.com , select icon, then click customize code tab, on top of you icon there is a small box, change it to any letter....
shout if its not clear enough , I will try to explain in a different way.