如何在iphone应用程序中添加自定义ttf字体?

Cha*_*har 3 iphone fonts plist

我有问题在我的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;
}
Run Code Online (Sandbox Code Playgroud)

DS-DIGI.ttf是我的字体,添加了tou资源forlder,而RRSGlowLabel是UILabel的继承类,现在该怎么办?

suj*_*406 7

为了在fontWithName调用中调用字体,字符串应该是Mac的"Font Book"应用程序中显示的字体名称,而不是引用的字体文件的实际文件名

  • http://www.developers-life.com/how-to-include-ttf-fonts-to-ios-app.html (2认同)