在Xcode 7.2中添加Font Awesome时出现问题 [英] Issue while adding Font Awesome in Xcode 7.2

查看:121
本文介绍了在Xcode 7.2中添加Font Awesome时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的iPhone应用程序中使用FontAwesome.我已经设置好所有东西.

I am trying to FontAwesome in my iPhone app. I have set Up all things.

但是每次我得到这个?(question)mark Image时.我确定我已经在我的项目以及Plist中正确添加了字体:

But every time I am getting this ?(question)mark Image . I am sure that I have added the font Correctly In my Project and also in Plist:

这是我的项目设置:

在我的项目中添加了真棒字体文件

Added Font Awesome File in My project

在我的Mac中安装了真棒字体".

Installed Font Awesome in my Mac.

在我的pList文件中添加密钥.

Add Key In my pList File.

要确认,请检查情节提要中的字体列表:

For Confirmation Checked the Font List in Storyboard:

以编程方式创建UILabel并设置如下字体:

Created a UILabel Programmatically and setting font like this:

 UILabel *lblFontAwesome = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 400)];
lblFontAwesome.center = self.view.center;
lblFontAwesome.font = [UIFont fontWithName:@"FontAwesome" size:35];
[lblFontAwesome setText:@"\uf014"];

[self.view addSubview:lblFontAwesome];

步骤6:我还添加了一些类别"文件.

这就是我得到的:

我在网上和SO上尝试了不同的解决方案.一个是

I tried different solutions on net and also from SO.One is this . But None of them seems to work. I am always getting this ?.

注意,当我尝试%C时,我得到此图像: 是的,并带有警告: 而且这也不是正确的图标.它只是显示未知图像.

Note when i try %C then I am getting this Image: And yes with a warning: and Also this is not the correct icon. It's just showing unknown image.

推荐答案

我确定我已经在Project和Plist中正确添加了字体

I am sure that I have added the font Correctly In my Project and also in Plist

好吧,不确定.显然,您没有正确地添加 .

Well, don't be sure. Clearly you have not added it correctly.

问题在于,尽管字体文件位于您的 project 中,但并未将其复制到您的 app 中.因此,它在正在运行的应用程序中不可用.

The problem is that, although the font file is in your project, it is not being copied into your app. Thus, it is not available in the running app.

这是解决方法.

在项目导航器(您的第一个屏幕截图)中,选择FontAwesome.ttf文件.现在,查看右侧的文件检查器.现在查看目标成员资格"部分.确保已选中应用目标.

In the project navigator (your first screen shot), select the FontAwesome.ttf file. Now look at the File inspector on the right. Now look at the Target Membership section. Make sure that the app target is checked.

这篇关于在Xcode 7.2中添加Font Awesome时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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