更新时间:2023-01-27 20:39:53
首先你需要为UILabel添加扩展名:
First you need to add extension to UILabel :
extension UILabel{
var defaultFont: UIFont? {
get { return self.font }
set { self.font = newValue }
}
}
第二次使用外观进行设置:
Second use appearance to set it:
UILabel.appearance().defaultFont = UIFont.systemFont(ofSize: 25)
希望有所帮助。