ios - 自定义字体未添加到项目中

标签 ios iphone objective-c uifont custom-font

我遇到了与描述相同的问题 here

我有一个名为 ANTIQUAA.TTF 的字体。此字体已添加到项目的支持文件中。 在我的应用程序列表中,我有应用程序提供的条目字体,并在那里添加了 ANTIQUAA.TTF。

我无法在应用程序中使用此字体。当我运行此方法时,我看不到字体。

 NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
    NSArray *fontNames;
    NSInteger indFamily, indFont;
    for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
    {
        NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
        fontNames = [[NSArray alloc] initWithArray:
                     [UIFont fontNamesForFamilyName:
                      [familyNames objectAtIndex:indFamily]]];
        for (indFont=0; indFont<[fontNames count]; ++indFont)
        {
            NSLog(@"    Font name: %@", [fontNames objectAtIndex:indFont]);
        }
        [fontNames release];
    }
    [familyNames release];

我错过了什么?

最佳答案

按“复制捆绑资源”中的添加按钮并单击字体文件。

enter image description here

关于ios - 自定义字体未添加到项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9649436/

相关文章:

ios - 使用 Xcode 11 与 Xcode 10 编译时,NSData 描述和 NSString stringWithFormat 具有不同的返回结果

ios - 如何在 ios 中的 imageview 上进行六边形图像 mask ?

iphone - iOS 应用程序在 Core Location 回调机制中崩溃

iOS OS 10.3.3 与 Alamofire POST(内容类型 JSON)问题

ios - 如何动画滚动像 "pull to refresh"这样的 View ?

ios - 如何在@selector方法中将int作为参数传递

ios - Swift ios 在某些屏幕尺寸上隐藏按钮

ios - Firebase 上传缺少所需的 dSYM 不工作

ios - 带有固定部分标题的 UITableView

iphone - Xcode没有编译任何项目? 'clang failed with exit code 255'