问题
I have this
Image(systemName: "arrow.right")
But how do i make it bold, semibold etc?
I am using the new SwiftUI.
回答1:
When using the font
modifier, set a weight to the font you're passing
Image(systemName: "arrow.right")
.font(Font.title.weight(.ultraLight))
回答2:
For UIKit, symbols can be configured as follows:
UIImage(systemName: "arrow.right",
withConfiguration: UIImage.SymbolConfiguration(pointSize: 16, weight: .bold))
回答3:
SwiftUI 1.0
I just wanted to also mention how to change the weight along with a custom font size.
HStack(spacing: 40) {
Image(systemName: "moon.zzz")
.font(Font.system(size: 60, weight: .ultraLight))
Image(systemName: "moon.zzz")
.font(Font.system(size: 60, weight: .light))
Image(systemName: "moon.zzz")
.font(Font.system(size: 60, weight: .regular))
Image(systemName: "moon.zzz")
.font(Font.system(size: 60, weight: .bold))
}
来源:https://stackoverflow.com/questions/56518735/how-do-i-set-a-weight-to-sf-symbols-for-ios-13