MattTheHack MattTheHack - 2 months ago 15
Objective-C Question

How to use a custom font in iOS tab bar

I'm using the font awesome resource for the UI of my iPhone application :

I have used it within my app screens like follows :

Phone.font = [UIFont fontWithName:kFontAwesomeFamilyName size:40];
Phone.text = [NSString fontAwesomeIconStringForIconIdentifier:@"fa-phone"];

But now I want to use it in the tab bar items of my tab bar controller i.e I want to set the icons of the tab bar to font awesome elements. How can this be done?


As per: How to change the Color of text in UITabBarItem in iOS 5

It looks like the solution may be sending the message to the appearance proxy, instead of one item:

[[UITabBarItem appearance] setTitleTextAttributes:@{
                                                    NSFontAttributeName:[UIFont fontWithName:@"AmericanTypewriter" size:20.0f]
                                                    } forState:UIControlStateNormal];

here is some more reference