alexdrone / ios-fontawesome Goto Github PK
View Code? Open in Web Editor NEWNSString+FontAwesome
NSString+FontAwesome
How can I update this project to support FontAwesome 4.6 icons ?
Tnx
Roberto
I just upgraded to the 4.x line, and have two icons that show up fine in the simulator, but not on a device: "fa-thumbs-up" and "fa-stack-overflow". Other icons seem to work fine.
if I use FAIconxxx it works, but if I try string id "fa-xxx" or simply "xxx" it always shows the default image.
I included all the header files already. Anything missing?
I found a build error while doing an "Analyze" build in my project. The fontSize
variable gets assigned a value but is never used inside the method. I'm assuming this was supposed to get set as one of the attributes in the call to -drawInRect:withAttributes but I am not sure so I didn't create a PR with any changes.
+(UIImage*)imageWithIcon:(NSString*)identifier backgroundColor:(UIColor*)bgColor iconColor:(UIColor*)iconColor andSize:(CGSize)size{
if (!bgColor) {
bgColor = [UIColor clearColor];
}
if (!iconColor) {
iconColor = [UIColor whiteColor];
}
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0f);
//// Abstracted Attributes
NSString* textContent = [NSString fontAwesomeIconStringForIconIdentifier:identifier];
CGRect textRect = CGRectZero;
textRect.size = size;
//// Retangle Drawing
UIBezierPath *path = [UIBezierPath bezierPathWithRect:textRect];
[bgColor setFill];
[path fill];
//// Text Drawing
int fontSize = size.width;
UIFont *font = [UIFont fontWithName:kFontAwesomeFamilyName size:fontSize];
@autoreleasepool {
UILabel *label = [UILabel new];
label.font = font;
label.text = textContent;
fontSize = fa_constraintLabelToSize(label, size, 500, 5);
font = label.font;
}
[iconColor setFill];
[textContent drawInRect:textRect withAttributes:@{NSFontAttributeName : font,
NSForegroundColorAttributeName : iconColor,
NSBackgroundColorAttributeName : bgColor
}];
//Image returns
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
Is there any way to add an icon + any text to a label or image?
e.g:
label.text = [NSString fontAwesomeIconStringForIconIdentifier:@"fa-github + myText"];
Missing icon-moon (unicode F186) and icon-bug (unicode F188)
Edit: Looks like these were from the 3.2 update, didn't see that.
I have upgraded to FA 4.2 but icons for paypal and others are not showing up though their enums are there in the lib.
Hello,
This is useful, but it has some issue.
I can't install when "pod install".
I think you didn't update "FontAwesome+iOS.pod" file.
A lot of times we have designer updating the asset and it would very nice if we can specified through the UI. However I only see the way to input is through the code. Let me know if anyone knows how to enter through ui.
Shinya
Hi there,
this package is awesome (yes!) and saving us a lot of time, but I am running is something that is either an issue or something I cannot understand.
When doing
let batteryIcon = UIImage.fontAwesomeIconWithName(.Battery0, textColor: UIColor.whiteColor(), size: CGSizeMake(12, 12))
I do get a 12 x 12 image but the battery image fills the space vertically and hence the right part is truncated (as the shape has a larger width).
I tries with ArrowsH that is has a larger width as well and it scales correctly (the icon does not fill the height)
Any idea where it might come from ?
Many thanks in advance.
Unicodes aren't likely to change and makes it easier to update the font later.
this is odd, setting the title in a navbar to "F0n7" results in the numbers being grey and the letters white.
I'm using UINavigationBar appearance to set the title text attributes.
Anyone else getting this?
Hi, Great work!. There is an other decent set of pictograms name Entypo http://www.entypo.com. Can you please add support for these fonts.
Cheers!
WhatsApp icon is missing. :(
Fontawesome contains fa-whatsapp but its missing in this lib.
@alexdrone Swift 4 Support?
Please update this beautiful library for fontawesome 3.2 update.
Could you make this awesome project support Carthage? Thanks.
==> pod update
Update all pods
Analyzing dependencies
Pre-downloading: FontAwesome+iOS
from [email protected]:alexdrone/ios-fontawesome.git
[!] Error installing FontAwesome+iOS
[!] Failed to download 'FontAwesome+iOS'.
Same error with pod install
==> pod install
Analyzing dependencies
Pre-downloading: FontAwesome+iOS
from [email protected]:alexdrone/ios-fontawesome.git
[!] Error installing FontAwesome+iOS
[!] Failed to download 'FontAwesome+iOS'.
I am running a fork here: https://github.com/paramaggarwal/FontAwesome-iOS that is using the name FontAwesome
on CocoaPods.
The code is exactly this repo itself. I would like that repo to be merged into this one and I would like to hand over ownership of the CocoaPod to you. Please get in touch with me using the email on my Github Profile.
Excellent work with the repo, @alexdrone!
I can't this library when I use use_framework!
on pod file.
At that time, this library doesn't copy the font file, so, app crashed.
If you use imageWithIcon:backgroundColor:iconColor:andSize: with for example the fa-bicycle and a square size i.e. (50 X 50) the image gets trimmed because doesn't fit in the square.
From the documentation, there are two options to use font awesome image[ via label strings and FAImageView].
But how to use the font awesome image to a UIImage?
For tab bar items with title, how can i set the font awesome image as the tab bar item image?
Hi,
I have just included the NSString+FontAwesome.h and .m on my project along with FontAwesome.ttf.
I made the changes on info.plist and also verified that Build Phase is correct copying the resources. I also checked the output folder and expected files are there.
So now the problem is the icon is not shown when I first access. just a box with an ? appear then when try to access a second time app chrash on the following method:
with error: EXC_BAD_ACCESS
Thanks in advance,
-Martin
Please check the screenshot. I add fonts in tableview cells and the UILabels' frame are the same. Is it a font issue?
BTW, I'm interested how can you reference the character for font-awesome with integer value? I know little about fonts things. Would you please give me some hint or keyword to research?
I'd like to use icon-spinner as an activity indicator. In css I would do this by assigning the icon-spin class. Is this functionality supported in FontAwesome+IOS?
Hi,
Thanks for this really useful lib, I was about to make mine when I found yours.
I'd love to use it with Cocoapods, even if I can do it "myself" in my podfile, it'll be great for the community if you could release this on CocoaPods.
If you need help writing the pod spec (https://github.com/CocoaPods/CocoaPods/wiki/The-podspec-format) and submitting it to Cocoapods, I'll be glad to help.
Thanks!!!
Any support for 4.1.0 coming?
Hello, I am new IOS developer, and I dont know how exactly I have to edit the plist file to add the font, thank you.
Please update this beautiful library to Font Awesome 4.0.3
Font awesome is an iconic font. Read more about it on http://fortawesome.github.com/Font-Awesome/
I can't find this repository in cocoa pods, only a fork of it: https://github.com/pepibumur/ios-fontawesome.
What's the status of it?
fontAwesomeIconStringForEnum:FAVolumeUp is giving me FAHeadphones...
Is there something wrong? I've had it working before. I just updated to the latest code, but I type one thing and I get another.
How can i use FAImageView and also how to pass this to UIImageView
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.