Pages

Wednesday, September 4, 2013

Embed Font in Objective C


Here are the Steps to embed font in Objective C

Step 1 -

Put font file inside project file and add that font in project, like in attached top Image - marked with Red square

Step 2 -

Add font in ProjectName-info.plist
By Adding "Fonts provided by application" in item 0 add the name as "FontFileName".

Step 3 -

Add following code inside some comman place of project.

#define BebasNeueFont(_size_)\
[UIFont fontWithName:@"BebasNeue" size:_size_]

Step 4 -

Now Apply font to the label or required place as follow

self.embededFont.font = BebasNeueFont(21);

Result will be shown as below