How to use Custom font in iPhone SDK/Objective c.


Is Your designer gives you a artistic font which is not available on iPhone?
Well in iOS sdk you can use any font you wish.

    1. Add  your custom font into your project , i.e. Dragged the font's ttf file (CALIBRIZ_0.TTF) into your resource folder from finder and check the "copy file to project folder" option. )
    2. Edit Info.plist: Add a new entry with the key Fonts provided by application.
    3. For each of your files, add the file name to this array



      Now set font to your label


      MyLabel.font = [UIFont fontWithName:@"Calibri" size:16];

      Make sure you give real font name in above code.  The font file name and its “real font name” can be different.
    4. I opened the font in font book (double click on your font in finder) to see what the real filename is and I see this:


      NOTE:- Font name when i Add in my xCode project is CALIBRIZ_0.TTF. 
      But it is not real name of font, so i opened it in FontBook and found that its real name is Calibri.   




    My answer at StackOverFlow (http://stackoverflow.com/questions/14376941/how-to-use-custom-fonts-in-iphone-sdk/14377069#14377069)

Comments

Popular posts from this blog

How to Make REST api call in Objective-C.

Launch iPhone simulator without Xcode.

Hacker Rank problem solution