1.代码
UIFont(name: "PingFangSC-Semibold", size: 16)
//精选动态label
lazy var headLabel:UILabel = {
let attributedString = NSAttributedString(string: "精选动态", attributes: [NSAttributedString.Key.font : UIFont(name: "PingFangSC-Semibold", size: 16),NSAttributedString.Key.foregroundColor:UIColor.hexColor(hexValue: 0x292929)])
let label = UILabel()
label.attributedText = attributedString
return label
}()
2.在storyboard中的设置
3.字体类型(style)的中英文对照
- 细体 - PingFangSC-Light
- 中黑体 - PingFangSC-Medium
- 常规体 - PingFangSC-Regular
- 中粗体 - PingFangSC-Semibold
- 纤细体 -PingFangSC-Ultralight
- 极细体 - PingFangSC-Thin