Tar*_*rmo 8 iphone uifont iphone-sdk-3.2
我已经将我的自定义字体添加到UIAppFonts并且它加载得很好:(显示在内[UIFont familyNames]).当我在viewDidLoad { [myLabel setFont: [UIFont fontWithName:@"CustomFont" size: 65.0]]; } 所有工作中手动设置字体并呈现字体时.
但是在IB中做同样的事情却不会(使用其他一些默认字体).必须为每个标签创建IBOutlets并在viewDidLoad中手动修复字体是非常痛苦的.
其他任何人都有问题获得自定义字体支持与3.2 SDK和IB一起使用?
向 Apple 提交了一份错误报告,结果发现这确实是一个错误。我最终使用的解决方法是这样的:
// LabelQuake.h
@interface LabelQuake : UILabel
@end
// LabelQuake.m
@implementation LabelQuake
- (id)initWithCoder:(NSCoder *)decoder {
if (self = [super initWithCoder: decoder]) {
[self setFont: [UIFont fontWithName: @"Quake" size: self.font.pointSize]];
}
return self;
}
@end
Run Code Online (Sandbox Code Playgroud)
在我们的博客上写了一篇更长的文章。
| 归档时间: |
|
| 查看次数: |
7417 次 |
| 最近记录: |