views:

403

answers:

2

Hello, I'm having a problem setting the font for UILabels and UITextViews with Interface Builder. I'm trying to set the font to Gill Sans. If I set it programmatically it works fine, like this:

    myLabel.font = [UIFont fontWithName:@"Gill Sans" size:24.0];

But if I try setting it with Interface Builder, I get the same behaviour described in this question here http://stackoverflow.com/questions/2647101/iphone-sdk-interface-builder-label-font-only-shows-when-editing-label, but the Gill Sans is supposedly available on the iPad (and it is, since it works if I set it by code). And if I run it and do this:

    NSLog(@"%@", myLabel.font.fontName);

it prints out "Helvetica".

Usually I wouldn't mind setting it programmatically, but the problem is that this particular class is used in several different places with different nib files to provide different layouts, so I can't have it hardcoded to always use the same font family. And subclassing it for each time it appears would be a huge pain, specially because I want to enable designers to create and change all the layout with interface builder whenever they want, and if they have to tell me what font they want every time so I can hardcode every particular case, that would be very awkward.

Has anyone experienced this problem before? Maybe Interface Builder is limiting me to use the iPhone fonts even though the xib file's target is already set to iPad, but how do I convince it that I'm targeting the iPad?

Thanks in advance, filipe

+1  A: 

You can only use fonts that are present on the iPhone OS. Check this answer for a way to embed custom fonts in your app.

ibeitia
Yes, I understand that, but I think the Gill Sans font IS present on the iPhone OS 3.2, isn't it? I mean, it works fine if I set the font by code. The problem is to set it with Interface Builder.
filipe
A: 

Ok, apparently this has been reported as a bug with IB 3.2.3:
https://devforums.apple.com/message/236134#236134
This guy says it used to work on 3.2.2, so I'll see if I can downgrade, or I'll just wait for a fix from Apple.

filipe