Last active
January 22, 2017 10:00
-
-
Save dimohamdy/c47992e14c1a3ee3315c06e2480e121e to your computer and use it in GitHub Desktop.
Change Font name Without change font size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UILabel.appearance().defaultFont = UIFont.systemFont(ofSize: 15/*Any Value*/, weight: UIFontWeightThin) | |
extension UILabel{ | |
dynamic var defaultFont: UIFont? { | |
get { return self.font } | |
set { | |
let sizeOfOldFont = self.font.pointSize | |
let fontNameOfNewFont = newValue?.fontName | |
self.font = UIFont(name: fontNameOfNewFont!, size: sizeOfOldFont) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment