本文介绍了使用 SF 符号时调整 UImage 的大小 - UIImage(systemName:)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下预打包的系统 SF 映像:

I have the following pre-packaged, system SF image:

UIImage(systemName: "location.fill")

这可能看起来微不足道,但我如何调整它的大小以使其更大?谢谢.

It may seem trivial, but how can I resize it to make it bigger? Thank you.

推荐答案

你可以实例化一个 UIImage.SymbolConfiguration.例如,您可以指定磅值:

You can instantiate a UIImage.SymbolConfiguration. For example, you can specify a point size:

let configuration = UIImage.SymbolConfiguration(pointSize: 24)
let image = UIImage(systemName: "location.fill", withConfiguration: configuration)

UIFont.TextStyle:

let configuration = UIImage.SymbolConfiguration(textStyle: .title1)
let image = UIImage(systemName: "location.fill", withConfiguration: configuration)

使用后一种方法,它将遵循设备上的无障碍文本大小设置.

With the latter approach, it will honor the accessibility text size settings on the device.

这篇关于使用 SF 符号时调整 UImage 的大小 - UIImage(systemName:)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 06:47