苹果自带字体
for fontName in UIFont.familyNames{
print(fontName)
}
自定义字体
- 准备自定义字体文件
DFPHaiBaoW12-GB.ttf
- 引入工程
- 修改
info.plist
文件,添加Fonts provided by application
一项
- 使用
let lb = UILabel(frame: CGRect(x: 1, y: 0, width: 200, height: 200)) lb.center = self.view.center
lb.text = "商品没找到"
lb.textColor = UIColor.red
lb.font = UIFont(name: "DFPHaiBaoW12-GB", size: 25)