[Swift] UIImage loads SF images

Set the picture size, set the picture color

let configuration = UIImage.SymbolConfiguration(pointSize: 26)
var applImg = UIImage(systemName: "applelogo", withConfiguration: configuration)?.withTintColor(.white, renderingMode: .alwaysTemplate)
if let size = applImg?.size {
    applImg = UIGraphicsImageRenderer(size:size).image {
        _ in applImg?.draw(in:CGRect(origin:.zero, size:size))
    }
}
appleBut.setImage(applImg, for: .normal)

Guess you like

Origin blog.csdn.net/u012881779/article/details/130361847