Xcode doesn't come with SFPro by default if we set deployment target as 9.3. The system font is SF. I am doubtful if loading SFPro font manually will work even if I have not set deployment target as 11.
You can download the fonts here: https://developer.apple.com/fonts/
Add the font files to your project and declare them in Project Info settings with Fonts provided by application
:
Then use the font with code like this (for example):
if let customFont = UIFont(name: "SFProDisplay-Regular", size: 32) {
theLabel.font = customFont
}
To find the actual names of the fonts, you can use this code:
for family in UIFont.familyNames {
let sName: String = family as String
print("family: \(sName)")
for name in UIFont.fontNames(forFamilyName: sName) {
print("name: \(name as String)")
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.