作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
假设我有这个自定义字体 字体.ttf
我有两个项目。 /projects/A
中的项目 A 和 /projects/B
我不想在项目之间复制粘贴此字体。
我创建了一个 cocoa touch 框架并向其中添加了 font.ttf
。然后在项目 A 和 B 中重用该框架。但它不起作用。可能吗?
最佳答案
根据这个thread , 你可以试试
let bundle = Bundle(identifier: "frameworkIdentifier")!
let url = bundle.url(forResource: "fontName", withExtension: "ttf")!
if let dataProvider = CGDataProvider(url: url as CFURL) {
let font = CGFont(dataProvider)
print(font)
}
//
//
关于ios - 如何在 Swift 中重用字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51706813/
我是一名优秀的程序员,十分优秀!