I've searched this site but I just found unanswered questions.
I've loaded a custom font into my xcode project. A [UIFont fontWithName:@"Laconic-Light" size:19]
works. But interface builder doesn't like the font. I can't use it with IB it always shows the default font. Is there a way to tell IB that its ok to use the font?
Add the font file to your Xcode projectSelect File menu > Add Files to "Your Project Name"... from the menu bar, select all the fonts you need to add, then click the Add button. Or drag the file from Finder and drop it into your Xcode project. Drag the font files from Finder and drop it into your Xcode project.
I have also this problem in Xcode 4. In my program, there are lots of UILabel
which have no IBOutlets
so I do in that way;
First, subclass the UILabel
to CustomFontLabel
Then, override the "awakeFromNib
" method
@implementation CustomFontLabel - (void)awakeFromNib { [super awakeFromNib]; self.font = [UIFont fontWithName:@"CustomFontName" size:self.font.pointSize]; } @end
Finally, in Interface Builder > Identity Inspector change class to CustomFontLabel
.
Another solution would be to subclass UILabel to load in your custom font. You can then reference it in IB, although you still cannot see the proper font.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With