因此,我在 SwiftUI View 中有一个文本,其中包含自定义 SF 符号:
Text("This is some text with a \(Image(uiImage: UIImage(named: "customSFSymbol")!)) symbol.")
问题如下:
我想将所有 View 设为白色,但是当我将 .foregroundColor(Color.white)
添加到 View 时,SF 符号保持黑色。
您可以看到它现在的样子here
提前感谢您的帮助!
最佳答案
您只需将 .renderingMode(.template)
添加到 Image
Text("This is some text with a \(Image(uiImage: UIImage(named: "customSFSymbol")!).renderingMode(.template)) symbol.")
关于ios - SwiftUI - 如何更改 TextView 中自定义 SF 符号的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67516300/