Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting font of UILabel with Interface Builder comes out Helvetica

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 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

like image 288
filipe Avatar asked Aug 05 '10 21:08

filipe


1 Answers

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.

like image 184
filipe Avatar answered Nov 15 '22 17:11

filipe