In Swift 2.0, how do I change the weight of the font with the code?It's easy to change on the Storyboard, but for various reasons I had to do it with the code.There is no problem functionally without changing the weight, but a slightly thinner weight makes it look better.swift font
The weight of the font can be specified by code only in system fonts.Except for the system font, the PostScript name will be directly designated as the
You can specify the weight of the system font by
UIFont class method
The second argument in , of type
CGFloat, contains the following nine constants:
and above, valid for iOS 8.2 and later.
You can specify nine weights, but only the system font San Francisco from iOS 9 is available.It doesn't work with Japanese font Hiragino Gothic, so you need to check it on the actual machine.
I think this site will be helpful.
© 2022 OneMinuteCode. All rights reserved.