gpt4 book ai didi

ios - CTFontManagerRegisterFontsForURL 在设备上不起作用

转载 作者:行者123 更新时间:2023-11-28 22:09:04 25 4
gpt4 key购买 nike

我正在尝试使用 CTFontDescriptorMatchFontDescriptorsWithProgressHandler 下载字体。与Apple提供的示例相同: https://developer.apple.com/library/ios/samplecode/DownloadFont/Listings/DownloadFont_ViewController_m.html

它工作正常,我可以在我的应用程序中显示下载的字体,但是在我重新启动我的应用程序后,我无法使用 fontWithName:size:[UIFont familyNames 创建 UIFont ] 不包括下载的字体。为了解决这个问题,我记录了字体路径并在启动应用程序时使用 CTFontManagerRegisterFontsForURL 注册字体。这样做之后,在模拟器上一切正常,但在设备上不工作!!!求助!!!

最佳答案

最后,我发现问题是当字体文件 url 类似于:/var/mobile/.../XXX.ttc 时,CTFontManagerRegisterFontsForURL 会失败,在我将 url 固定为 file:///var/mobile/.../XXX.ttc 之后,一切都会好起来的。

关于ios - CTFontManagerRegisterFontsForURL 在设备上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23290958/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com