Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add the font awesome image to a tab bar item image? #25

Open
jas54 opened this issue Dec 5, 2013 · 5 comments
Open

How to add the font awesome image to a tab bar item image? #25

jas54 opened this issue Dec 5, 2013 · 5 comments

Comments

@jas54
Copy link

jas54 commented Dec 5, 2013

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?

@artisani
Copy link

artisani commented Apr 7, 2014

@jas54:
I've also tried to use fontawesome to acheive this in my iOS app and I haven't managed yet. Did you solve it eventually?

@jimmychu0807
Copy link

@cloud-hot
Copy link

I have saw a API
"(UIImage_)imageWithIcon:(NSString_)identifier backgroundColor:(UIColor_)bgColor iconColor:(UIColor_)iconColor iconScale:(CGFloat)scale andSize:(CGSize)size;" in the UIImage+FontAwesome.h
But if i use it through swift it will also post a compiler error

UIImage(icon: <String!>, backgroundColor: <UIColor!>, iconColor: <UIColor!>, iconScale: , andSize: )

Could you tell me how to use this API? Thanks!

@mzamoras
Copy link

mzamoras commented Jun 7, 2015

I tried this and seemed to work just fine! But only tried for TabBarItems. It's either a fix or just a work around. I`m using Xcode 6.3 and get it working on real device, besides simulator.

Take a look.

UIImage *iconDefault  = [UIImage imageWithIcon:@"fa-github" backgroundColor:[UIColor clearColor] iconColor:[UIColor whiteColor] andSize:CGSizeMake(32, 32)];
UIImage *iconSelected = [UIImage imageWithIcon:@"fa-github" backgroundColor:[UIColor clearColor] iconColor:[UIColor blueColor] andSize:CGSizeMake(32, 32)];

UITabBarItem *tabItem = [_tabBar.items objectAtIndex:0];
tabItem.image         = [iconDefault imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
tabItem.selectedImage = [iconSelected imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];];

@aqua30
Copy link

aqua30 commented Aug 13, 2015

You can check this https://github.com/aqua30/FontAwesomeTab .
It lets you add font awesome images in the tabs icon. May be its helpful to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants