How to add the font awesome image to a tab bar item image?
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?
@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?
Try this project: http://nschum.github.io/FontAwesomeIconFactory/
For specific on how to create a tabbar image, refer to this file:
https://github.com/nschum/FontAwesomeIconFactory/blob/master/FontAwesomeIconFactoryDemo/FontAwesomeIconFactoryDemo/TabBarController.m
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: <CGFloat>, andSize: <CGSize>)
Could you tell me how to use this API? Thanks!
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];];
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.