Reputation: 19
Is there any way to change the default font of the Application from one place, not each view controller and not each element category??
for example in html and CSS, you can define the global font from CSS with one line of code. Thanks.
Upvotes: 0
Views: 3236
Reputation: 31
when you add the font to info.plist you already changed the default font of the Xcode , try to leave the UILabel Font as system Font and change only the style and run your app you will have what you want.
Upvotes: 0
Reputation: 540
I don't know if its what you ask, but you can change all the fonts in your app in appDelegate. Will change all the fonts in the buttons, labels, etc.
you can do it creating a extension form UILabel like this
extension UILabel {
var substituteFontName : String {
get { return self.font.fontName }
set { self.font = UIFont(name: newValue, size: self.font.pointSize) }
}
}
then in the didFinishLaunchingWithOptions in your appDelegate you can call the variable and pass the name of the font you want, like this:
UILabel.appearance().substituteFontName = "Kyrial Sans Pro"
Upvotes: 2