代码之家  ›  专栏  ›  技术社区  ›  B.O.M.B

使用SwiftUI Xcode 15在启动屏幕中选择自定义字体

  •  0
  • B.O.M.B  · 技术社区  · 2 年前

    我无法让我的自定义字体显示在我添加到项目的启动屏幕的属性检查器中。这可以在SwiftUI中添加的启动屏幕中完成吗?

    我为我的项目添加了一个新的启动屏幕 -将字体安装到系统字体簿中,并在textedit中工作 -将字体添加到项目复制并添加到文件夹和目标 -将字体添加到自定义目标iso属性->应用程序提供的字体 -运行以下代码,就会打印出字体系列和字体 -能够在预览中看到字体 -重新启动Mac和Xcode -更改了字体颜色以刷新字体

    // I see the font name and can use it in the ContentView but not the     launch screen attribute inspector -> custom -> [select custom .ttf     font here]
        init() {
        for familyName in UIFont.familyNames {
            print(familyName)
            for fontName in UIFont.fontNames(forFamilyName: familyName){
                print("--\(fontName)")
            }
        }
     }
    
    0 回复  |  直到 2 年前