如何将自定义ttf字体添加到iphone应用程序? [英] How to add custom ttf fonts to iphone application?

查看:338
本文介绍了如何将自定义ttf字体添加到iphone应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有添加字体到我的iPhone应用程序的问题
我想知道如何去做,并且让我指定我没有使用IB,并且我继承了UILabel并且创建了这个新类的标签,



请帮助我,
我已经下载了ttf并希望在我的应用程序中使用
我添加了由应用程序提供的字体我的应用程序,然后添加字体名称与ttf扩展名,但仍然没有工作,我该怎么办?

  @implementation RRSGlowLabel 
$ b - (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-DIGIsize:self.font.pointSize]];
}
返回自我;

$ / code>

其中DS-DIGI.ttf是我的字体,增加了tou资源forlder,
和RRSGlowLabel是UILabel的继承类,现在该怎么办? 解决方案

检查以下博客文章: p>

在iPhone应用程序中使用自定义字体



在iPhone中加载自定义字体


I have problem of adding fonts to my iphone application I want to know how to do it, and let me specify that I am not using IB and I have inherited the UILabel and making label of that new class,

Please Help me out, I have downloaded the ttf and want to use in my app, I added "Fonts Provided by application" to my app and then added the font name with ttf extension, but still didn't work, what should I do ?

@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;
}

Where DS-DIGI.ttf is my font, added tou resources forlder, and RRSGlowLabel is inherited class of UILabel, now what should I do?

解决方案

Check the below blog posts:

Using custom fonts in iPhone applications

Load custom font in iPhone

这篇关于如何将自定义ttf字体添加到iphone应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆