First I created class name as NSString+FontAwesome.h
and NSString+FontAwesome.m
in NSString+FontAwesome.h
like following way
@import Foundation;
typedef NS_ENUM(NSUInteger, FaIcon) {
FaMoonO = 0xf186,
FaArchive = 0xf187
};
@interface NSString (AwesomeString)
//creates a string with the font awesome character
+(NSString*)awesomeIcon:(FaIcon)index;
@end
and in NSString+FontAwesome.m
code is like this
#import "NSString+FontAwesome.h"
@implementation NSString (AwesomeString)
+(NSString*)awesomeIcon:(FaIcon)index
{
return [NSString stringWithFormat:@"%C", (unichar)index];
}
@end
I am using code like this for label and it work properly.
label.font = [UIFont fontWithName:@"FontAwesome" size:30];
label.textColor = [UIColor whiteColor];
label.text = [NSString awesomeIcon:FaBook];
But I want to used it in array any advice. My array code is like this.
iconarray =[[NSMutableArray alloc] initWithObjects:[NSString awesomeIcon:FaArchive],nil];
But it don't show me anything. How can I add [UIFont fontWithName:@"FontAwesome" size:30]
in an array.
Please help..