无法在iOS应用中使用自定义字体

编程入门 行业动态 更新时间:2024-10-25 16:17:56
本文介绍了无法在iOS应用中使用自定义字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试为我的iOS应用使用自定义字体。这是我的工作

I'm trying to use custom font for my iOS app. Here is what I do

我将自定义字体(m.tff)添加到Xcode支持文件目录。此外,我创建了一个名为Fonts的条目,由myApp.plist中的字体(m.tff)的值名称提供。

I added my custom font (m.tff) to Xcode Supporting files directory. Also I create entry called Fonts provided by application with value name of the font (m.tff) in myApp.plist

在我的视图中我有一个标签

In my view I have a label

UILabel *label = [[UILabel alloc]initWithFrame:CGRect(10, 20, 230, 30)]; label.font = [UIFont fontWithName:@"My custom font" size:15];

等...

问题就是当我启动应用程序时,标签中的文字是使用默认字体而不是使用特定字体。

The problem is that when I launch the app the text in label is with default font instead of using the specific one.

我想念的是什么?

EDITED

好吧现在看起来很有效,但字体只适用于像?但不是信件。 我正在使用西里尔文btw。

Well it seem works now, but the font applies only for characters like , ? but not for letters. I'm using cyrillic btw.

推荐答案

用它来获取所有可用的字体

Use this to get all the fonts available

// List all fonts on iPhone NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]]; for(NSString *familyName in familyNames) { NSLog(@"family: %@", familyName); NSArray *fontNames = [[NSArray alloc] initWithArray:[UIFont fontNamesForFamilyName:familyName]]; for(NSString *fontName in fontNames) { NSLog(@" font: %@", fontName); } }

查找嵌入的字体,看看它是否是名字是一样的。

Look for the font you embedded and see if it is the name is the same.

更多推荐

无法在iOS应用中使用自定义字体

本文发布于:2023-11-07 22:33:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1567619.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   字体   iOS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!