Custom Fonts For IOS 5

I posted an answer on StackOverFlow recently that I think will be helpful for the the rest of you IOS developers. It's regarding how to place custom fonts on your labels and textfields in IOS 5.

Here's the resource I used to learn about this.

 

However, the trickiest part for me is finding the correct font name. So try this:

for the font "MuseoSans" I added MuseoSans_700.otf to my plist (in the respective spot)

 

NSLog(@"%@", [UIFont fontNamesForFamilyName:@"Museo Sans"]);
// the line above gives you eligable font names eg. MuseoSans-700

// example usage
UIButton *myButton = [[UIButton alloc] init];
myButton.titleLabel.font = [UIFont fontWithName:@"MuseoSans-700" size:16];

Viola.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <pre>
  • Syntax highlight code surrounded by the {syntaxhighlighter SPEC}...{/syntaxhighlighter} tags, where SPEC is a Syntaxhighlighter options string or "class="OPTIONS" title="the title".
  • Lines and paragraphs break automatically.
  • E-Mail addresses are hidden with reCAPTCHA Mailhide.

More information about formatting options

CAPTCHA
Complete this form and then pat yourself on the back.