ios - 如何快速加载框架中的自定义字体?
问题描述
我正在开发自定义框架并希望从项目设置中导入自定义字体。
我已按照以下所有步骤操作:
* Added external fonts into the project folder.
* Added into the build targets.
* Fonts are added in the Copy bundle resources in the project target settings.
* Fonts are added in the Property list
但总是得到 nil 对象。如果我在普通应用程序中尝试它工作正常。当我尝试导入我的自定义框架并且它不起作用时。
请指教。
extension UIFont {
static let systemFontRegular = "SFProText-Regular"{
return UIFont(name: systemFontRegular, size: size)!
}
}
解决方案
推荐阅读
- rust - Rust 中只有一个变量名和一个分号的语句是什么意思?
- android - 在授予权限时调用 UsbManager 请求权限以执行例程时的事件侦听器是什么?
- python - 如何在函数和类中使用破坏 - tkinter?
- python - 创建对象后从列表中打印新消息
- javascript - 图像周围的灰色框,引导程序
- postman - Postman 的 pm.test() 函数的规范是什么?
- sql - 使用 django 从谷歌 VM 连接到谷歌云 SQL
- javascript - 对于给定的字符串数组,每个字符串都有一个项目名称,按项目名称对所有字符串进行分组
- node.js - AWS codebuild 在构建期间从 Node 包中删除开发依赖项
- reactjs - 除非手动重新加载页面,否则嵌入式 Facebook 不会使用 Gatsby 显示