我在向 iPhone 应用程序添加字体时遇到问题 我想知道如何做到这一点,让我指定我没有使用 IB,并且我继承了 UILabel 并制作了该新类的标签,
请帮帮我, 我已经下载了 ttf 并想在我的应用程序中使用, 我在我的应用程序中添加了“应用程序提供的字体”,然后添加了带有 ttf 扩展名的字体名称,但仍然不起作用,我该怎么办?
@implementation RRSGlowLabel
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if(self != nil) {
self.glowOffset = CGSizeMake(0.0, 0.0);
self.glowAmount = 0.0;
self.glowColor = [UIColor clearColor];
[self setFont: [UIFont fontWithName: @"DS-DIGI" size: self.font.pointSize]];
}
return self;
}
其中 DS-DIGI.ttf 是我的字体,添加了 tou 资源 forlder, 而RRSGlowLabel是UILabel的继承类,现在我该怎么办?
最佳答案
为了在 fontWithName 调用中调用字体,该字符串应该是 Mac 的“字体簿”应用程序中显示的字体名称,而不是引用的字体文件的实际文件名
关于iphone - 如何向 iPhone 应用程序添加自定义 ttf 字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6608573/